Print odd and even from 1 to 20 in C.


 #include<stdio.h>

#include<conio.h>

int main()

{

int i;

clrscr( );

for(i=1; i<=20; i++)

if(i%2==0)

{

printf("\n The given number is even %d",i);

}

else

{

printf("\n The given number is odd %d",i);

}

getch( );

return 0;

}

To run:













output:



No comments:

Post a Comment

theengineerschoice01@gmail.com