Skip to content

Conditional exercises#

Question

Write a block of code that prints "The number is equal to five" if the variable num is equal to five, or "The number is not equal to five" if it is not.

Question

Write a block of code that prints "Wrong password" if the variable password is not equal to "01234", and "You're in!" if it is.

Question

Write a for loop that prints the numbers from 1 to 10 and warns user when the number is a multiple of 3.

Hint: you should use the remainder operator % to test whether a number is divisible by another one.