Sum of squares of numbers from 1 to N
Swift
Easy
loops
Task «Sum of squares of numbers from 1 to N»
Write a program that takes a positive integer N as input and calculates the sum of squares of all integers from 1 to N inclusive. Use a for or while loop. It is guaranteed that N does not exceed 1000.
Input Format
One integer N (1 ≤ N ≤ 1000).
Output Format
One integer — the sum of squares of numbers from 1 to N.
Examples
Example 1
INPUT
aaabbbcc
OUTPUT
a3b3c2
main.swift