Learn to code with step-by-step lessons. A place for students to work through programming fundamentals and build skills.
Stack n layers of blocks: layer k uses k² blocks. The total for n layers is 1² + 2² + … + n².
Ask for n, compute with a loop, print the total.
Skills: for, squaring in loop.
Example: n = 3 → 1 + 4 + 9 = 14.