โ Back to Loops
Question 328
Numbers 1 to 20 on One Line
Numbers 1 to 20 on One Line
Use a loop to print the numbers 1 to 20 on a single line separated by single spaces, with no trailing space, then a newline. The exact output is: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Print a space BEFORE each number except the first.
Expected Output:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Topics:
Loops
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (cout, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.