This program shows given number is odd or even.
#include <stdio.h>
#include <math.h>
main () {
int a, b;
printf ("Enter the Number:");
scanf ("%d", &a);
b = a % 2;
if (b == 0)
{
printf ("The given Number %d is even\n", a);
}
else
{
printf ("The given Number %d is odd\n", a);
}
getch();
}
Output::--
Enter the Number: 20
The given Number 20 is even
How it works
After getting input, it divides the number by 2 and check if its remainder is 0 or not. If 0 then it shows as even else odd