Program to print the given series




 #program to calculate the following series: x-x/4+x/9-x/16

    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**2 #for each term

        a+=1

        sum+=t*m

        m*=-1 #for changing sign

    

    print(sum)




Comments

Popular Posts