Showing posts with label Calculating Even and Odd numbers. Show all posts
Showing posts with label Calculating Even and Odd numbers. Show all posts

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();
}

Popular Posts