Write a program to compute 1/2+2/3+3/4+...+n/n+1 with a given n input by input parameters.


Topic: Write a program to compute 1/2+2/3+3/4+...+n/n+1 with a given n input by input parameters.

Solution

n=int(input())
sum=0.0
for i in range(1,n+1):
    sum += float(float(i)/(i+1))
print(sum)



List all Python Programs