C Program#169 – To check whether the given number is Even or Odd using if else statement.

Program to check whether the given number is Even or Odd using if else statement.:

Program Logic:

  • A number is Even if it can be completely divided by 2, thus test condition will be if (number%2==0)
  • If the condition results in TRUE, display a message that number is an Even Number.
  • Otherwise, the number is Odd, thus display the message that number is Odd number.
  • Still not understood ? Here is a proper working example in action below.




Full Well Commented, Self-Explanatory Example Program of the same given below.

Below Here are TWO (2) different Outputs of the program.



Output of the Program (Run 1):

Output of the Program (Run 2):