Even or Odd Number Example Program in C Programming Language

Here we have the C Programming Language Example Program to Check for Even or Odd Number.

When you divide a number by 2 if you get the remainder as 0 then that number is said to be Even Number. If the remainder is a Non Zero value then it is an Odd Number.

Here we are using the modulus operator available in C programming language. It is denoted by using % ( percentage ) symbol.

C Program to Check for Even or Odd Number

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

For Explanation Checkout this Video