print the sum of the following series
1-x+x²-x³+x⁴-x⁵.....x^n
❌DO NOT SPAM❌
[[∆correct answers get a follow and 10 thanks∆]]
Answers
Answered by
3
Answer:
Input: X = 2, N = 5
Output: Sum = 31
1 2 4 8 16
Input: X = 1, N = 10
Output: Sum = 10
1 1 1 1 1 1 1 1 1 1
Answered by
2
Question:-
Write a python program to print the sum of the series
1-x+x²-x³+x⁴.....xⁿ
Program:-
n=int(input("Enter the value of n: "))
x=float(input("Enter the value of x: "))
s=0
for i in range(0,n):
if (i%2==0):
s=s+x**i
else:
s=s-x**i
print("Sum of the series is: ",s)
Similar questions
Social Sciences,
2 months ago
English,
2 months ago
English,
2 months ago
English,
5 months ago
Math,
5 months ago
Math,
10 months ago
Environmental Sciences,
10 months ago