7. Write a Python program to find the sum of squares of the first 100 natural numbers.

 

Static 

total = 0
for num in range(1,101):
     sq = num **2
     total += sq
print(“Sum of Square of Natural number from 1 to 100 is :-“,total)

Output :- 

 

Dynamic :- 

total = 0
n = int(input(“Enter the final value :- “))
for num in range(1,n+1):
      sq = num **2
      total += sq
print(“Sum of Square of Natural number from 1 to 100 is :-“,total)

Output :-