← Back to Loops
Question 88
Add Up the Numbers 1 to 10
Add Up the Numbers 1 to 10
Calculate the total of all the numbers from 1 to 10 by adding them one at a time inside a loop. Create a variable named sum that starts at 0. Loop from 1 to 10 and add each number to sum. After the loop finishes, print the final total with console.log.Expected Output:
55= newline. The output ends with a newline — print one after the last line.
Hints3 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.