In this C program, we will learn how to check whether it is odd or even number using switch case statement. Any numbers divisible by 2 are even numbers whereas numbers which are not divisible by 2 are odd numbers.

Any even number can be represented in form of (2*N) whereas any odd number can be represented as (2*N + 1).

Any even number can be represented in form of (2*N) whereas any odd number can be represented as (2*N + 1).

**Even Numbers**examples: 2, 6 , 10, 12**Odd Number**examples: 3, 5, 9 ,15#### Required Knowledge

## C program to check a number is Even of Odd using switch case statement

#include <stdio.h> int main() { int num; printf("Enter an Integer\n"); scanf("%d", &num); switch(num%2) { /* Even numbers are divisible by 2 */ case 0: printf("%d is Even", num); break; /* Odd numbers are not divisible by 2 */ case 1: printf("%d is Odd", num); break; } return 0; }Output

Enter an Integer 8 8 is Even

Enter an Integer 5 5 is Odd

**Related Topics**