Chapter 4: Problem 37
The factorial of a nonnegative integer \(n\) is written as \(n !\) (pronounced " \(n\) factorial") and is defined as follows: \(n !=n \cdot(n-1) \cdot(n-2) \cdot \ldots \cdot 1 \quad(\text { for values of } n \text { greater than or equal to } 1)\) and \(n !=1 \quad(\text { for } n=0)\) For example, \(5 !=5 \cdot 4 \cdot 3 \cdot 2 \cdot 1,\) which is 120 a) Write an application that reads a nonnegative integer and computes and prints its factorial. b) Write an application that estimates the value of the mathematical constant \(e\) by using the following formula. Allow the user to enter the number of terms to calculate. \(e=1+\frac{1}{1 !}+\frac{1}{2 !}+\frac{1}{3 !}+\ldots\) c) Write an application that computes the value of \(e^{x}\) by using the following formula. Allow the user to enter the number of terms to calculate. \(e^{x}=1+\frac{x}{1 !}+\frac{x^{2}}{2 !}+\frac{x^{3}}{3 !}+\ldots\)
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.