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
#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)
Comments
Leave a comment