+ 1
summation n=0 to infinity((x**n)/n!) how to write this solution in python
2 odpowiedzi
+ 4
""" This code finds the summation of series by taking number of terms and value of x as input from the user """
num = int(input('Please enter the number of terms : '))
x = float(input('Please enter the value of x :'))
i = 1
j = 1
sum = 0
while i <= num :
value = 1
fact = 1
while j <= i :
value = value * x # calculates x^n
fact = fact * j # calculates n!
j += 1
term = result / fact # calculates each term
i += 1
sum += term
print('The sum of the given series is : ' + str(sum))
#Hope you find it useful
+ 1
https://youtu.be/cNze5ZAlp2w SEE C PROGRAM SUMMATION