Write a program to print the sum of squares of first n natural numbers


Topic: Write a program to print the sum of squares of first n natural numbers

Solution

n = 21
sum_n = 0
for i in range(1, n+1):
    sum_n += i**2
print(sum_n)



List all Python Programs