# Program to find sum of the series i) 1/r and ii) 1/r^2 for n = 10,100,1000,10000,100000,1000000
n=input("Enter the no. of terms:")
n=int(n)
s=0
s1=0
for i in range (1,n):
s=s+1/(float(i))
s1=s1+(1/float(i))**2
print("The sum of 1/r series is=",s)
print("The sum of 1/r^2 series is=",s1)
n=input("Enter the no. of terms:")
n=int(n)
s=0
s1=0
for i in range (1,n):
s=s+1/(float(i))
s1=s1+(1/float(i))**2
print("The sum of 1/r series is=",s)
print("The sum of 1/r^2 series is=",s1)
Comments
Post a Comment