005-002-009
if-else: Even/Odd Number Check
Easy
Problem Description
if-else: Even/Odd Number Check
In this problem, you will create a program that reads one integer and determines whether it is even or odd using an if-else statement, and displays the result to standard output.
Learning Objective: Understand binary conditional branching using if-else statements
Overview
Create a program that receives one integer as input and outputs "Even" if the number is even, or "Odd" if the number is odd.
Specifications
- Read one integer
- Output "Even" if even (divisible by 2)
- Output "Odd" if odd (not divisible by 2)
Input Format
4
Output Format
Even
Note
Use the modulo operator (%) for even/odd checking. If number % 2 equals 0, the number is even.
Ready to Try Running Code?
Log in to access the code editor and execute your solutions for this problem.
Don't have an account?
Sign Up