Header Ads

Even and Odd checking

Even and Odd checking in C?

Even number:- Number divisible by 2 is known as even number.

Odd number:-Number not divisible by 2 is known as odd number.

Program

#include<stdio.h>
#include<conio.h>
main()
{
 int num;
 printf("Enter the number for checking:\n");
 scanf("%d",&num);
 if(num%2==0)
 printf("The given number is even");
 else
 printf("The given number is a odd number");
 getch();
}

Output

Enter the number for checking:
5
The given number is a odd number_

No comments