Code Logo

Even or Odd Checker

Published at19 Apr 2026
Easy 0 views
Like0

This problem is pretty simple once you notice the rule. In Even or Odd Checker, you are given one integer and need to decide which label matches it.

The main job is not to do a long calculation. You only need to check whether the number divides evenly by 2. If it does, print EVEN. If it does not, print ODD.

For example, if the input is 8, the answer is EVEN because 8 can be divided by 2 without a remainder. If the input is 7, the answer is ODD because dividing by 2 leaves something behind.

So the task is to test one number, decide whether it is even or odd, and return the matching word.

Example Input & Output

Example 1
Input
n = 7
Output
ODD
Explanation

7 leaves a remainder of 1 when divided by 2.

Example 2
Input
n = 8
Output
EVEN
Explanation

8 can be divided by 2 without any remainder.

Example 3
Input
n = 0
Output
EVEN
Explanation

0 is treated as an even number.

Algorithm Flow

Recommendation Algorithm Flow for Even or Odd Checker
Recommendation Algorithm Flow for Even or Odd Checker

Solution Approach

A good way to solve this problem is to use the modulo operation. The idea is simple: divide the number by 2 and check the remainder.

The nice thing about this method is that it gives a direct answer right away. You do not need extra loops, arrays, or helper variables beyond the input itself.

Once we choose that method, the logic becomes very short. First, read the number into a variable like n.

Next, check this condition:

n mod 2 = 0

If that condition is true, the number is even, so the output should be EVEN.

If that condition is false, the number is odd, so the output should be ODD.

You can think of the solution as one decision point: remainder 0 means even, and any other remainder means odd. That is why this problem stays short and clear.

Best Answers

Solutions Coming Soon

Verified best solutions for this Challenge are still being analyzed and will be available soon.