CJCoding With Joseph
15per day

Break on Zero (while input)

Keep asking for numbers in a while loop and break when the user enters 0. For each input, print a prompt and echo the number just read, then when 0 is entered, break and print 'Game Over!'.

Output format per input:
Enter a number: [value]

Example (inputs: 5, -2, 1, 0):
Enter a number: 5
Enter a number: -2
Enter a number: 1
Enter a number: 0
Game Over!

Expected Output:

Enter a number: 5
Enter a number: -2
Enter a number: 1
Enter a number: 0
Game Over!
Topics:
LoopsUser Input
๐Ÿ“ฅ Auto-Input:
5\n-2\n1\n0\n
This input is automatically fed to your program's stdin
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (sysout, psvm, fori)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.