How to determine odd even number from a given range in c programming

Sunday, March 15, 2009

How to determine odd even number from a given range in c programming The following program code will show how to compute the odd even number from a given range of number .To compute the odd even number we have to enter the upper limit .The following program will take an input and display the result. Programming code: *********************************************** #include #include void main() { clrscr(); int uprange,a=1; printf("Enter The uprange:"); scanf("%d",&uprange); printf("\nThe Even number from 1 to %d is:",uprange); while(a { if(a%2==0) printf("%d, ",a); a=a+1; } a=1; printf("\n\nThe Odd number from 1 to %d is :",uprange); while(a { if(a%2!=0) printf("%d,",a); a=a+1; } getch(); } **************************************************** After running this program you will see the output as following. OUTPUT:

0 comments:

Visitors

PlugIn.ws - Free Hit Counter, Web Site Statistics, Traffic Analysis

  © Blogger template Leaving by Ourblogtemplates.com 2008

Back to TOP