Here is the C program to check whether a number is odd or even — simple and clear.
#include <stdio.h>
int main()
{
int num;
printf("Enter a number: ");
scanf("%d", &num);
if (num % 2 == 0) {
printf("the number is even");
} else {
printf("the number is odd");
}
return 0;
}
Tags:
C courses