QUIZ: Is it Even or Odd?

QUIZ: Is it Even or Odd?

February 7, 2026

The Challenge!

Alright, tech wizards! Let’s fire up those brain cells with a classic: Even or Odd! But here’s the catch: we’re diving deep into the modulo operator (%).

Quick refresher: The modulo operator (%) returns the remainder of a division. For example, 7 % 2 equals 1 because 7 divided by 2 leaves a remainder of 1.

The Question: If Number % 2 == 0, what does that tell you about Number? Is it even or odd? Don’t let the simplicity fool you!

A Little Nudge…

Think about what it means for a number to be perfectly divisible by 2… What’s left over?

The Solution!

Brain check! If Number % 2 == 0, then Number is even. That’s because an even number is perfectly divisible by 2, leaving no remainder.


            // Example in JavaScript
            function isEven(number) {
                return number % 2 === 0;
            }

            console.log(isEven(4)); // Output: true (Even)
            console.log(isEven(7)); // Output: false (Odd)
            

Your Turn!

Can you write a function in your favorite programming language that determines if a number is odd using the modulo operator? Share your code in the comments below!

Share this Post

Leave a Reply

Your email address will not be published. Required fields are marked *