Advertisements
Write a program to check whether a number is even or odd in C
#include<stdio.h>
#include<conio.h>
void main()
{
int num;
clrscr();
printf("\nEnter any number : ");
scanf("%d",&num);
if(num%2 == 0)
printf("\nThe given number is EVEN.");
else
printf("\nThe given number is ODD.");
getch();
}
Output :
Enter any number : 46
The given number is EVEN.