41.WAP to display the sum of the following series
s=1+1/2+1/3.........
CODE:
sum=0.05
n=int(input("How many terms?\n"))
for i in range(1,n+1):
sum=sum+(1/i)
print("sum of series is ",sum)OUTPUT:
How many terms?
5
sum of series is 2.3333333333333335
Comments
Post a Comment