Students will be able to:
Challenge Level: Growing experience
This programming challenge is linked to the following lessons:
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.
Your program should display the outputs shown in this table for the given inputs provided:
|265||You entered an odd number!|
|0||You entered an even number!|
|-22||You entered an even number!|
Click on the green flag, enter the inputs provided in the “testing examples” to see the expected output of your program.
when green flag clicked ask [Enter a number:] and wait set [number v] to (answer) if <((number) mod (2)) = > then else end
say [You entered an even number!] say [You entered an odd number!]
() 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