C Programming Code Examples C > If Else and Switch Case Code Examples C Program to Check if a given Integer is Odd or Even C Program to Check if a given Integer is Odd or Even The program takes the given integer and checks whether the integer is odd or even. - Take the integer to be checked as input. - Find the remainder of the integer by dividing it by 2. - Use if, else statement to check whether the remainder is equal to zero or not. - Print the output and exit. #include <stdio.h> void main() { int ival, remainder; printf("Enter an integer : "); scanf("%d", &ival); remainder = ival % 2; if (remainder == 0) printf("%d is an even integer\n", ival); else printf("%d is an odd integer\n", ival); } User must first enter the integer to be checked which is stored in the variable ival. Find the remainder of the integer by dividing the variable ival by integer 2 and the value is stored in the variable remainder. Use if, else statement to check whether the value of the variable remainder is equal to zero or not. If it is equal to zero, then print the output as "the integer is an even integer". If it is not equal to zero, then print the output as "the integer is an odd integer".