← Back to Loops
Question 370
Count Down In Twos
Count Down In Twos
Read a starting number and print it, then every value two less than the previous one, stopping before the value would drop below 1; one value per line, using a while loop. Input: one integer of at least 1, no prompt. An odd start ends on 1 and an even start ends on 2.
Expected Output:
8 6 4 2
= newline. The output ends with a newline — print one after the last line.
Hints2 available
Sign in to use hintsTopics:
Loops
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.