Break on Zero (while input)
easyQuestion 53Keep 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): see Expected Output.
Expected output
Enter a number: 5 Enter a number: -2 Enter a number: 1 Enter a number: 0 Game Over!
= newline. The output ends with a newline, so print one after the last line.
Hints4 available
Sign in to use hintsTopics
LoopsUser Input
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.