Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a C++ program that determines the largest number for which your computer c

ID: 3763217 • Letter: W

Question

Write a C++ program that determines the largest number for which your computer can represent its factorial exactly using the longdouble type. A factorial is the product of all numbers from 1 to the given number. For example, 10 factorial (written 10!) is

1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 = 3,628,800

As you can see, the factorial grows to be a large number very quickly. Your program should keep multiplying the prior factorial by the next integer, then substract 1 and check wheter the difference between the factorial and the factorial minus 1 is less than 1--an error tolerance. When the maximum precision of the type is reached, and least signficant digits of the product to be stored, then subtracting 1 should have no effect on the value. Because floating-point representations may not be exact, however, the expression

abs((number - 1) - number)

may not exactly equal 1. That's why you need to include a small error tolerance in the comparison.

Use functional decomposition to solve this problem. Code the program using good style and include helpful documenting comments. To keep the user informed of progress, you may wish to output all of the intermediate factorial values. The greatest number and its factorialshould be clearly labeled.

in c++ . it sounds like it wants me keep the loop going until factorial is less than 1 but stop the loop when it reaches that point and im not sure how i would go about doing that.

we are limited to what we have learned in previous chapters 1 through 10

isbn of the book:9781284028768

any help would be appreciated

Explanation / Answer

Hi,

Output:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote