Home » NO IDEA » Even Number and Odd Number

Even Number and Odd Number

Blog Stats

  • 14,863 hits
December 2012
M T W T F S S
« Sep   Jan »
 12
3456789
10111213141516
17181920212223
24252627282930
31  
//To check whether the given number is even or odd
#include<stdio.h>
int main()
{
 int num;
 printf("\n Enter the number");
 scanf("%d",&num);
 if(num%2==0)
 {
 printf("\n It is an even number");
 }
 else
 {
 printf("\n Not a even number");
 }
 return 0;
}

//geneation of the even number
#include<stdio.h>
int main()
{
 int range,i;
 printf("\n Enter the range");
 scanf("%d",&range);
 printf("\n The even number are");
 for(i=1;i<=range;i++)
 {
 if(i%2==0)
 printf("\n\t %d",i);
 }
 return 0;
}
Advertisements

1 Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: