Even Odd program in C - C Program to check if number is even or odd
Learn C - C tutorial - c program to check if number is even or odd - C examples - C programs
Number is even or odd in C
- If the given number is exactly divisible by 2 then its an even number else it is an odd number.
- We will determine whether a number is odd or even by using different methods all are provided with a C language program.
Sample code
#include <stdio.h>
int main()
{
int num=7;
if((num%2)== 0)
printf("%d is even.\n", num);
else
printf("%d is odd.\n", num);
return 0;
}
Output
7 is odd.