Jan 29, 2013

Calculating Even and Odd numbers

/*Calculating Even and Odd numbers*/

#include<stdio.h>
#include<conio.h>
void main()
clrscr();
int i,n;
printf("n=?");
scanf("%d",&n);
printf("\nOdd numbers=\n");
i=0;
while(i<n)
{
i++;
if(i%2)
printf("%2nd",i);
}
printf("\n\n Even numbers=\n");
i=1;
while(i<=n)
{
i++;
if(|(i%2))
printf("%2d",i);
}
getch();
}

No comments:

Post a Comment

Thank you for visit this site. You will get many programming news from here and learn programming very easily.

Popular Posts