120. Python Program to Compute the 1+3+6+10+ …….+n Series.
How does this program work?
- This program is used to find the Sum of the given series 1+3+6+10+ …….+n using Python.
- The integer entered by the user is stored in variable n i.e last term for the given series.
- Declare variable sum and Initially initialize with 0.
- By using for loop we can find the sum of given series upto nth term.
Here is the code
n = int(input("Enter a number: "))
num = 0
print("Series till the enter number: ")
for i in range(1,n+1):
i=int(i * (i+1)/2)
print(i,end=" ")
num+=i
print("\nSum of the series: ",num)