C Program: Even or Odd Checker

Code (Terminal Input)

#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; }

Input

Enter a number: 7

Output

The number is Odd.

Code (Assigned Value)

#include <stdio.h> int main() { int num = 10; if(num % 2 == 0) printf("The number is Even."); else printf("The number is Odd."); return 0; }

Input

Value Assigned: 10

Output

The number is Even.
Home