We all know, the number which can divide from 2 completely, means if the reminder is zero, then the number is even and which cannot are odd numbers.

The same we will do in our program to know whether the number, which is input through the keyboard, is even or odd.

Remember the **modulus operator (%)**, this operator returns the reminder, when dividing any number. So we will condition the if statement, if the reminder is zero after diving the number by 2, then the number is even otherwise odd.

**Let’s have ah Look The Program ►►**

#include<stdio.h>
#include<conio.h>
void main()
{
int num;
printf("Enter Number to know it's even or odd");
scanf("%d",&num);
if(num%2==0)
printf("%d is Even",num);
else
printf("%d is Odd",num);
getch();
}

I think you already understand the program. I simply used the modulus operator (%) and condition **if(num%2==0), **means after dividing the number by 2, if the reminder is zero then number is even, else the number is odd.

### Like this:

Like Loading...

*Related*