human
Program to find sum of 1 + x / 2 ! + x ^ 2 / 3 ! + ... + x ^ n / ( n + 1 ) ! | Function to compute the series sum.
To store the value of S [ i - 1 ].
Iterate over n to store sum in total.
Update previous with S [ i ].
Driver code.
Get x and n.
Find and prthe sum"
Solution in Python:
assistant
#Here is code to program to find sum of 1 + x / 2 ! + x ^ 2 / 3 ! + .
 def sum ( x , n ) :
	total = 1.0 ;
	previous = 1.0 ;
	for i in range ( 1 , n + 1 ) :
		previous = ( previous * x ) / ( i + 1 ) ;
		total = total + previous ;
	return total ;
if __name__ == ' _ _ main _ _ ' :
	x = 5 ;
	n = 4 ;
	print ( " Sum ▁ is : ▁ " , sum ( x , n ) ) ;