Read a whole number and print EVEN if it is even, otherwise ODD.
What to build
A program with two possible answers.
Requirements
- Read a whole number.
- Print
EVENorODD.
Input
One whole number between -1000000 and 1000000.
Output
EVEN or ODD.
Constraints
The number is between -1000000 and 1000000.
Example
Input:
4
Output:
EVEN
Why it works
An even number leaves no remainder when divided by 2, and this also holds for negative numbers.
Examples
Example 1 · Input
4
Expected output
EVEN
Example 2 · Input
7
Expected output
ODD
Prompts inside input() are ignored when checking, so input("n: ") is fine.
Hints
Hint 1
n % 2 is 0 for every even number, including negative ones.
Solution
Show one correct solution (try it yourself first)
n = int(input())
if n % 2 == 0:
print("EVEN")
else:
print("ODD")