Write a C program to check whether a given number (integer) is Even or Odd.
Program :-
#include <stdio.h>
int main()
{
int number;
scanf("%d", &number); /*An integer number is taken from the test case */
if(number % 2 == 0)
printf("%d is even.", number);
else
printf("%d is odd.", number);
}
Input | Output | |
Test Case 1 | 24 | 24 is even. |
Test Case 2 | 51 | 51 is odd. |