# Check Even and Odd Number C Program

## C Program To Check Even and Odd Number

Learn How To Check Even and Odd Number in C Programming Language. This C program for finding Even and Odd Integers accepts a Number from the User and then checks if the Number is Even or Odd. The Modulus Operator is primarily used to identify whether the Entered Number is Even or Odd.

#### What is an Even Number?

If a Number or an Integer is Divisible by 2, then it is an Even Number. We can check it in C Code using the condition: **num%2==0**

#### What is an Odd Number?

If a Number or an Integer is not Divisible by 2, then it is an Odd Number. We can check it in C Code using the condition: **num%2!=0**

**Must Read: C Program To Find Simple Interest using Functions**

#### Find Even and Odd Number in C Programming without Function

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | #include<stdio.h> int main() { int num; printf("\nEnter a Number:\t"); scanf("%d", &num); if(num % 2 == 0) { printf("\n%d is an Even Number", num); } else { printf("\n%d is an Odd number", num); } printf("\n"); return 0; } |

**Must Read: C Program To Check if Entered Character is Alphabet or Digit**

#### C Program To Check Even and Odd Number using Function

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include<stdio.h> int check(int a); int main() { int num, res; printf("\nEnter a Number:\t"); scanf("%d", &num); res = check(num); if(res == 1) { printf("\n%d is an Even Number", num); } else { printf("\n%d is an Odd number", num); } printf("\n"); return 0; } int check(int a) { if(a % 2 == 0) return 1; else return 0; } |

**Must Read: C Program To Check Smallest Digit in an Integer**

#### C Program To Find Even or Odd Numbers using Conditional Operators or Ternary Operators

1 2 3 4 5 6 7 8 9 10 | #include<stdio.h> int main() { int num, result; printf("\nEnter a Number:\t"); scanf("%d", &num); result = ((num % 2 == 0) ? printf("\n%d is an Even Number\n", num) : printf("\n%d is an Odd number\n", num)); return 0; } |

**Must Read: C Program To Calculate Age of Any Person**

#### Output

In case you get any Compilation Errors or any doubts in this C Program To Check Even and Odd Number, let us know about it in the Comment Section below.

So many methods for finding Even and Odd Numbers!!! Mind blowing! Thank you so much for making my basics so clear.

The even and odd number checking c prpgram using ternary operators is really good. Thanks for that

Cheers.