(adsbygoogle = window.adsbygoogle || []).push({ google_ad_client: "ca-pub-2960223314593660", enable_page_level_ads: true }); Program to find the sum of squares of n numbers - TecGlance

Header Ads

Program to find the sum of squares of n numbers


Program to find the sum of squares of n numbers

num =input("Enter the number upto which the sum of squares is to be found : ")
sum=0
for i in range(num+1):
    sum+=i**2
print"The sum is : ",sum

OUTPUT :

 Enter the number upto which the sum of squares is to be found :  4
The sum is :  30
  
Enter the number upto which the sum of squares is to be found :  5
The sum is :  55
  
Enter the number upto which the sum of squares is to be found :  12
The sum is :  650

No comments

Powered by Blogger.