C Program to Check Even or Odd number

C Program to Check Even or Odd number : C Program Example

An even number is an integer that is exactly divisible by 2. Example: 2,4,6, 8,10,12,14,16 etc

An odd number is an integer that is not exactly divisible by 2. Example: 1, 3,5,7, 9,11, 15,17 etc

odd and even number
odd and even number

C Program start from here

#include
int main()
{
int number;

printf(“Enter an integer: “);
scanf(“%d”, &number);

if(number % 2 == 0)
printf(“%d is even.”, number);
else
printf(“%d is odd.”, number);

return 0;
}

 

Output:

Enter an integer: 9
9 is odd.

 

 

[xyz-ihs snippet=”Discuss”]

Leave a Reply