# Check for odd/even numbers using modulo operation

Challenge Level: Growing experience

Learning outcomes

Students will be able to:

## Requirement:

Create a program which asks the user to enter a number and checks if the number is odd or even. Use the "modulo" operation for this challenge.

## Testing examples:

Your program should display the outputs shown in this table for the given inputs provided:

Input Output
265 You entered an odd number!
0 You entered an even number!
-22 You entered an even number!

## Languages

Scratch

#### What it should look like

Click on the green flag, enter the inputs provided in the “testing examples” to see the expected output of your program.

Recommended blocks
when green flag clicked

ask [Enter a number:] and wait

set [number v] to (answer)

if <((number) mod (2)) = [0]> then
else
end
say [You entered an even number!]

say [You entered an odd number!]
Hints
• To find out if a number is even or odd, use the () mod () block (under "Operators") to find the remainder after dividing that number by two. If the remainder is zero the number is even. For example: (37) mod (10) //7