C PROGRAMMING LANGUAGE **Please provide comments. **you ll notice that Euler's number is involved. The math library has a special built in function that uses Euler's number for the calculation. Please use that instead of defining a constant e value.
C PROGRAMMING LANGUAGE **Please provide comments. **you ll notice that Euler's number is involved. The math library has a special built in function that uses Euler's number for the calculation. Please use that instead of defining a constant e value.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
C
**Please provide comments.
**you ll notice that Euler's number is involved. The math library has a special built in function that uses Euler's number for the calculation. Please use that instead of defining a constant e value.

Transcribed Image Text:Question 4) For any integer n> 0, n! is defined as the product n * n – 1 * n – 2 .. * 2 * 1! is
defined to be 1. It is sometimes useful to have a closed-form definition instead; for this purpose,
an approximation can be used. R.W. Gosper proposed the following such approximation
formula:
n! z n"e-n
2n +
Create a program that prompts the user to enter an integer n, uses Gosper's formula to
approximate n!, and then displays the result. The message displaying the result should look
something like this:
Enter a value for
5! equals approximately 119.97003
5
For this problem, define a user defined function that performs the calculation. The user defined
function takes one argument of type int and will return the result of the computation of type
double to display. Name the user defined function FactorialApprox. Define a constant
macro called PI and set it to 3.14159265
Expert Solution

Step 1
Required:
**you ll notice that Euler's number is involved. The math library has a special built in function that uses Euler's number for the calculation. Please use that instead of defining a constant e value.
Step by step
Solved in 2 steps with 2 images

Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education