Question: Redo Listing 5.4 using a type array object instead of a built-in array and type long double instead of long long. Find the value of
Redo Listing 5.4 using a type array object instead of a built-in array and type long double instead of long long. Find the value of 100!

Here is the output from the program in Listing 5.4:
0! = 1
1! = 1
2! = 2
3! = 6
4! = 24
5! = 120
6! = 720
7! = 5040
8! = 40320
9! = 362880
10! = 3628800
11! = 39916800
12! = 479001600
13! = 6227020800
14! = 87178291200
15! = 1307674368000
Factorials get big fast!
Listing 5.4 formore.cpp // formore.cpp more looping with for #include const int Arsize = 16; int main() { } // example of external declaration long long factorials [Arsize]; factorials [1] = factorials [0] = 1LL; for (int i = 2; i < Arsize; i++) factorials[i] = i factorials [i-1]; for (int i = 0; i < Arsize; i++) std::cout < < i < < "!= " < < factorials [i] < < std::endl; return 0;
Step by Step Solution
3.36 Rating (162 Votes )
There are 3 Steps involved in it
include const int ArSize 16 example of external declaration int main long double factorials A... View full answer
Get step-by-step solutions from verified subject matter experts
