Question: Please code in C. 3.. The factorial of a nonnegative integer n (written n!) is defined as follows: n!-1*2*3*...*n (for values of n greater than

Please code in C. 3.. The factorial of a nonnegative integer nPlease code in C.

3.. The factorial of a nonnegative integer n (written n!) is defined as follows: n!-1*2*3*...*n (for values of n greater than or equal to 1) and n! 1 (for n -0) a. Prompt the user for an integer n between 5 and 12 for which the factorial is to be found. Use a while validation loop to restrict the value of n to an integer between 5 and 12. Use a for loop to determine the value of the factorial. Use type double for the factorial (although an jnt will work for 121, an int will not store larger factorials) b. (For 1 point extra credit) In the same program use a for loop to estimate the value of the mathematical constant e using the formula 1! 2! 3! Have the user enter the number of terms for the approximation. Print the estimation with 6 decimal digits. Test with 8 terms. Compare with the actual value of e using the exponential function from the math library

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!