← Back to Loops
Question 87
Print the Even Numbers to 10
Print the Even Numbers to 10
Print all the even numbers from 2 up to and including 10, each on its own line. Instead of adding 1 each time, make your loop counter jump by 2 so it lands only on even numbers. Start at 2 and keep going while the counter is less than or equal to 10.
Expected Output:
2 4 6 8 10
= 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 · Shift+Alt+F to format · Ctrl+Space to expand shortcuts (clog, fn, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.