Question #185499

Write a program with loops that compute the sum of all squares between 1 and 100 

(inclusive).

Output

Sum of all squares from 1 to 100 (inclusive) = 338350


Expert's answer

#initialize sum to zero
sum=0

for i in range(1,101):
    square=i*i
    sum=sum+square
    
#display the sum of the squares
print("Sum of all squares from 1 to 100 (inclusive) = ", sum)

LATEST TUTORIALS
APPROVED BY CLIENTS