Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Write a program that calculates the sum of squares of numbers from 1 to n.

Easy

Problem Statement

Write a program that calculates the sum of squares of numbers from 1 to n.

Sample Input

n = 3

Sample Output

14

Limits

Time: 2s · Memory: 256 MB

Code Editor
00:00
// Calculate the sum of squares from 1 to n function sumOfSquares(n) { } console.log(sumOfSquares(3));
Log in or sign up to run or submit your code.Log inSign up
Input
n = 3
Expected Output
14