Question: Write a program that asks the user for an input, x, of type double and an input, N, of type int. The program should then

 Write a program that asks the user for an input, x,

Write a program that asks the user for an input, x, of type double and an input, N, of type int. The program should then calculate the sum sigma^N_n = 0 x^n! Since you are calculating the factorial for each n, starting at 1, you do not need to calculate the factorial from scratch at each loop iteration. You can use the fact that n! = n*(n - 1)! As N gets large, your result should approach e^x. if x = 1, the sum should be ~2.71828. Remember if n! is larger than MAX_INT = 32,768, the value will be incorrect, so don't make N larger than 15. Also, 0! = 1 by definition

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!