 Home >>c programs >c program to check odd or even

# c program to check odd or even

### Check Given number is even number or odd number

Even numbers are those numbers which are perfectly divisible by 2 else it is an odd number.

There are two ways to check whether the input number is even or odd:

1. using modulus operator (%) by dividing number by 2 and,
2. using Bitwise Operator

Let's take an example :

```#include <stdio.h>
int main()
{
int num=11;
if(num%2==0)
{
printf("Given Number is eveno num %d",num);
}
else
{
printf("Given Number is odd num %d",num);
}
}
```
Output :Given Number is odd num

### Get input from keyword and check number is even or odd number

A user inputs a number, and we check whether it’s a even or odd. when the input number is completely divisible by 2 then it's an even number otherwise its an odd number.

Let's take an example :

```#include <stdio.h>
int main()
{
int num=0;
//get input and store in num variable
scanf("%d",&num);
if(num%2==0)
{
printf("Given Number is even num");
}
else
{
printf("Given Number is odd num");
}
return 0;
}
```
Output :