#include <stdio.h>
int main() {
int num;
printf("Enter an integer: ");
scanf("%d", &num);
// true if num is perfectly divisible by 2
if(num % 2 == 0)
printf("%d is even.", num);
else
printf("%d is odd.", num);
return 0;
}Enter an integer: 9
9 is odd.num.num is perfectly divisible by 2 or not is checked using the modulus % operator.2, test expression number%2 == 0 evaluates to 1 (true). This means the number is even.0 (false), the number is odd.#include <stdio.h>
int main() {
int num;
printf("Enter an integer: ");
scanf("%d", &num);
(num % 2 == 0) ? printf("%d is even.", num) : printf("%d is odd.", num);
return 0;
}Enter an integer: 8
8 is even.