Program to print the given series




# x- x2+ x3 - x4 + ............xn

#     2   3    4                n


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


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

a=1

sum=0

m=1

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

    t= x**a/a

    a+=1

    sum+=t*m

    m*=-1

print(sum)



Comments

Popular Posts