C Program to check Given Number is Even or Odd

In this c programming example we will learn check given number is Even or Odd number


  1. Take an integers from user by printf() function
  2. This integer will assign to a by scanf() function
  3. Now take module of given number a
  4. If the result '0' then given number is Even, if result is '1' then given number is Odd number


Simple C example to check given number is Even or Odd

#include <stdio.h>

int main() {
  int a;
  printf("Enter number a : ");
  scanf("%d", &a); 
   if (a % 2 == 0)
      printf("%d is even\n", a);
       printf("%d is odd\n", a);
   return 0;



Enter number a : 22

22 is even    

Enter number a : 27  &nbs

27 is odd



Subscribe For Daily Updates