5. Write a program to input the
value of x and n and print the sum of the following series:
Python
x = float(input("Enter
the value of x: "))
n = int(input("Enter
the value of n: "))
sum1 = 0
for i in range(0, n + 1):
sum1 += x ** i
print("Sum
of the series 1 + x + x^2 + ... + x^n:", sum1)
No comments:
Post a Comment