C LAB‎ > ‎(Sem1) Introduction to C‎ > ‎

WAP to check if number is odd or even.

posted Nov 10, 2010, 5:05 PM by Neil Mathew   [ updated Nov 18, 2010, 4:44 AM ]

SOURCE CODE: 


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include<stdio.h>
 
int main()
{
 
int num;
printf(" Enter the number: ");
scanf(" %d ", &num);
 
if(num%2==0)
printf("\n Number is Even. ");
else
printf("\n Number is Odd. ");
 
return 0;
}

 

 

OUTPUT:

 Enter the number: 5
 Number is Odd. 

 

Enter the number: 8
Number is Even. 

 


 
Comments