Computer Science, asked by sanskritipramanick, 7 months ago

S = 1 + ² + 3² +4^2 +5²+..... n​

Answers

Answered by AikaRen
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:

  1. first of all we assign a no. to the variable n as the total no. of terms.
  2. Then we take the value 0 in variable s...as later on we use this var for computing the sum of squares.
  3. 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 .
  4. 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...
  5. 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