42.WAP to display the sum of the following series

 s=1/2 + 2/3 + 3/4 + .....

CODE:

sum=0.0
n=int(input("How many terms?\n"))
for i in range(1,n+1):
sum=sum+(i/(i+1))
print("sum of series is ",sum)

OUTPUT:
How many terms?
5
sum of series is  3.5500000000000003

Comments

Popular posts from this blog