Skip to main content

Problem Statement

Write a C program that takes an integer as input and checks whether it is even or odd.

Solution

#include <stdio.h>

int main() {
    int n;
    scanf("%d", &n);
    if (n % 2 == 0)
        printf("Even\n");
    else
        printf("Odd\n");
    return 0;
}

Input

7

Output

Odd