S = 1 + ² + 3² +4^2 +5²+..... n
Answers
Answered by
1
Answer:
hope you want the program in python language...taking that line....
n=int(input("ENTER TOTAL NUMBER OF TERMS: "))
s=0
for i in range(1, n+1):
s=s+ i**2
print("TOTAL SUM IS:" s)
Explanation:
- first of all we assign a no. to the variable n as the total no. of terms.
- Then we take the value 0 in variable s...as later on we use this var for computing the sum of squares.
- We take a range from 1 to n+1....coz in a range the iteration continues till the no. before the limiting no. In this case we have to execute n iterations...so we take the limiting no. as n+1 .
- then we calculate the sum of sqaures in var s. I ve used the exponential form for computing the sum....you can also use (i*i) if you want...
- Then ...I've finally printed the sum.
HOPE THIS HELPS...and from next time do mention the language in which you wanted the program to be written....
Similar questions