Program to print the given series



x=int(input("Enter the value of x "))

n=int(input("Enter the value of n "))


a=1

sum=0

m=1

f=1

for i in range(1,n+1):

    t= x**a/f #for each term

    f*=a

    a+=1

    sum+=t*m

    m*=-1 #for changing the sign


print(sum)



Comments

Popular Posts