โ Back to Loops
Question 216
Sum of Squares 1 to N
Sum of Squares 1 to N
Read an integernfrom standard input and print the sum of the squares1*1 + 2*2 + ... + n*n, with no trailing newline. For example, if the input is3, the sum is1 + 4 + 9, so print: 14 Accumulatei * iin a loop.
Expected Output:
14
Topics:
Loops
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (p, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.