Odd or Even Program in C Using Conditional Operator

Odd or even program in c using conditional operator. In this program, we can execute odd or even programs in c.

Odd Number Definition

A whole number that cannot be divided into two equal whole numbers by two The numbers one, three, five, and seven are all odd numbers. A number that cannot be divided into two equal groups is called an odd number. 

Odd numbers are those that cannot be evenly divided by two. It is impossible to divide it evenly into two separate integers. When we divide an odd number by two, we get a remainder.

Even Number Definition

a whole number that can be divided into two equal whole numbers by two. Even numbers are zero, two, four, six, and eight. 

An even number is any number that is exactly divisible by two. i.e., if dividing a number by two leaves no remainder, the result is an even number.

Conditional Operator in C

In C programming, conditional statements are used to make decisions based on the conditions. When there is no condition around the statements, they are executed sequentially. 

A program decides which statement to execute based on the result of the evaluated condition, which is also known as branching.

int main()
int n;
printf("Enter the Number\n");
n%2 == 0 ? printf("Even Number\n") : printf("Odd Number\n");
return 0;


Enter the Number
Odd Number