Skip to content

Latest commit

 

History

History
21 lines (11 loc) · 674 Bytes

02-lottery.md

File metadata and controls

21 lines (11 loc) · 674 Bytes

Lottery

Ask the user to press any key.

Display any 3 random space-separated digits between 0-9 e.g. 6 2 7.

If any of them is 7, output "Congratulations!".

Else, output "Try again! Better luck next time.".

Repeat. See Variants.

Variants

  1. Only show congratulations if at least two of the generated numbers are 7.

  2. Only show congratulations if all three of the generated numbers are 7.

  3. Only show congratulations if all three of the generated numbers are even numbers e.g. 0, 2, 4 or 6.

  4. Only show congratulations if all three of the generated numbers are odd numbers e.g. 1, 3, 5 or 7.