*Language is C, Please use YOUR OWN code and don't copy and paste the same answer from the previous answers as I've ran

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

*Language is C, Please use YOUR OWN code and don't copy and paste the same answer from the previous answers as I've ran

Post by answerhappygod »

*Language is C, Please use YOUR OWN code and don't copyand paste the same answer from the previous answers as I've ran thecode and tried to change it and it's wrong!!*
Language Is C Please Use Your Own Code And Don T Copy And Paste The Same Answer From The Previous Answers As I Ve Ran 1
Language Is C Please Use Your Own Code And Don T Copy And Paste The Same Answer From The Previous Answers As I Ve Ran 1 (138.39 KiB) Viewed 49 times
*Language is C, Please use your own code and don't copyand paste the same answer from someone else!!*Also if you could explain the code afterwards that would begreatly appreciated. Thanks!!
For any integer n >0, n! (n factorial) is defined as the product n* n − 1 * n − 2 ... * 2 * 1. And 0! 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 approximation formula: n! ≈n"e". √ ( 2₁ + 1 ) T 2n 3 a) Create a function takes a value n as input and returns the approximation for factorial value. b) Create another function takes n as input and computes then returns the accurate value for n! as n * n - 1 * n − 2 ... * 2 * 1. This can be done using a loop. Review lecture 10. c) Your program should prompt the user to enter an integer n, call both functions to compute the approximate and the accurate value for n!, and display the results. The message displaying the result should look something like this: 5! equals approximately 119.97003 5! is 120 accurately. d) Create a third function that would find percent errors. The function accepts the accurate and approximate values, computes the percent error and returns it. Is the approximation a good representation of the actual value? Use printf to display the error. percent error = [accurate value — approximate value| accurate value x 100 e) Ask the user if they'd like to repeat the program and allow for iterations on the program. Exit the program if the user is finished. Note 1: Use a constant macro for Pl and use the value of 3.14159265. Note 2: factorials grow quickly, so your compiler might not be able to store the factorial of a large number. Feel free to upgrade your variable type form a typical int to an unsigned long long int. Test on values less than n = 12. Note 3: Make sure negative numbers are avoided for factorial calculations.
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply