Answer to Question #185499 in Python for Woyengimiesindo Malati

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


1
Expert's answer
2021-04-26T02:15:47-0400
#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)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS