C programe : print even numbers from 1 to 50
pictorial presentation :
code :
// print even numbers
#include <stdio.h>
int main() {
int i;
printf("Even numbers between 1 to 50 (inclusive):\n");
for (i = 1; i <= 50; i++)
{
if(i%2 == 0)
{
printf("%d ", i);
}
}
return 0;
}
sample output : 2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50
Subscribe to:
Post Comments (Atom)
0 Comments:
Post a Comment