Write a C program that can read any number and check is it even number or odd number.

Even numbers are those which are divisible by 2, and which numbers are not divisible 2 is called odd numbers.

But in term of programming for find even number we check the remainder of number is zero or not when number divided by zero, If remainder is equal to zero that means number is divisible by 2. To find remainder of any number you need to use modulo (%) operator in C language, which return remainder as a result.

First open CodeBlocks and create a file.Then save the file named test.cpp.Then write the following simple C code.Finally Run the Code.


#include<stdio.h>

int main()
{
int n;
printf("Enter any number: ");
scanf("%d",&n);
if(n%2==0)
{
printf("This number is Even.");
}
else
{
printf("This number is Odd.");
}
return 0;
}

Output: