Redo Listing 5.4 using a type array object instead of a built-in array and type long double
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 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!
Transcribed Image Text:
Listing 5.4 formore.cpp
// formore.cpp more looping with for
#include
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;
Fantastic news! We've Found the answer you've been seeking!
Step by Step Answer:
Answer rating: 77% (9 reviews)
include const int ArSize 16 example of external declaration int main long double factorials A...View the full answer
Answered By
Dansteve Matoke
As a consequence of more than three years of experience in ACADEMIC WRITING, I have vast, diverse knowledge and impeccable grammar. I guarantee the quality of my work across multiple fields. I intend to precisely meet the clients' expectations. Let's work together to achieve exceptional grades.
0.00
0 Reviews
10+ Question Solved
Related Book For
Question Posted:
Students also viewed these Computer science questions
-
Shown here is Minitab output from a Friedman test. What is the size of the experimental design in terms of treatment levels and blocks? Discuss the outcome of the experiment in terms of any...
-
Refer to Exercise 5. Here is computer output from the least-squares regression analysis of the beer and blood alcohol data. a. What is the estimate for 0 ? Interpret this value. b. What is the...
-
Refer to Exercise 6. Here is computer output from the least-squares regression analysis of the perch data. a. What is the estimate for 0 ? Interpret this value. b. What is the estimate for 1 ?...
-
The dot-com business has raised many issues about accounting practices, some of which are of great concern to both the SEC and the FASB. Important ones relate to the valuation and classification of...
-
Explain how efficient inventory management affects the liquidity and profitability of the firm.
-
A pistoncylinder device initially contains 2 kg of refrigerant-134a at 800 kPa and 80C. At this state, the piston is touching on a pair of stops at the top. The mass of the piston is such that a...
-
Precision Balls Ltd produces and sells high-quality lawn bowls sets. Each set of balls is contained in a wooden carrying case, which is purchased from an outside supplier. The wooden cases are held...
-
Multiple Choice 1. What is a basic premise of the acquisition method regarding accounting for a noncontrolling interest? a. Consolidated financial statements should be primarily for the benefit of...
-
The Oldham family have three sons, two of whom have been diagnosed with autism. Both sons have benefited from home-based, one-on-one Applied Behavior Analysis Therapy (ABA). The therapy costs $7000 a...
-
Backline Advertising creates, plans, and handles advertising campaigns in a three-state area. Recently, Backline had to replace an inexperienced office worker in charge of bookkeeping because of some...
-
Listing 4.6 illustrates a problem created by following numeric input with line-oriented string input. How would replacing this: cin.getline(address,80); with this: cin >> address; affect the working...
-
In Listing 6.2, what is the effect of replacing ++ch with ch+1? Heres some sample output from the program in Listing 6.2: Type, and I shall repeat. An ineffable joy suffused me as I beheld...
-
The following unadjusted trial balance was taken from the ledger of Mirandas Management Services on 30 June 2019. Required (a) Prepare a 10column worksheet using the following additional information...
-
Suppose that Disney is considering one more Toy Story movie. The company is not confident in box office sales, but they do believe that the file will create merchandising opportunities (DVDs, toys,...
-
3. Give two examples from the movie of each type of stroke. Explain your thinking for each and identify the impact of each example on the relationships in the movie. (8 marks) 4. Identify characters...
-
Problem 1 h - Calculate Summations: Using the same sample of complaints used in previous questions (data is also shown below), calculate the following summation values: (Ex)2 E Sample Data: 5, 6, 1,...
-
You love energy drinks and have decided to create one of your own. You've come up with a good formula, but you recognize that the taste and benefits are similar to those of most energy drinks now on...
-
Explain why if assets are valuable resources and asset accounts have debit balances why do expense accounts also have debit balances. What is meant by the normal balance?
-
Construct a multiplexer using AND gates, OR gates, and inverters that has as input the four bits x0, x1, x2, and x3 and the two control bits c0 and c1. Set up the circuit so that xi is the output,...
-
The financial statements of Eastern Platinum Limited (Eastplats) are presented in Appendix A at the end of this textbook. Instructions (a) Does East plats report any investments on its statement of...
-
Sensitize each path in the combinational part of the circuit in Figure 11.12 to obtain a complete test set that comprises as few tests as possible. Show how your test set can be applied to test this...
-
List all single faults in the circuit in Figure 11.4a that can be detected using each of the tests w 1 w 2 w 3 w 4 = 1100, 0010, and 0110. W2 W3 WA D D b D (a) Circuit D f
-
Derive a test set that can detect all single faults in the decoder circuit in Figure 4.14c. Wo- WI- En (c) Logic circuit D Yo YI Y2 Y3
-
When owning and operating any business, whether it's a caf or a pool cleaning business, it's very important that you know exactly what your income and expenditure is. Is your business making money or...
-
Resources Unlimited Corporation was formed in 1985 through the merger of two natural pipeline companies. The result was the largest gas distribution network in the United States, with 38,000 miles of...
-
Toyota was the world's first automobile manufacturer to produce more than 10 million vehicles per year, which it has done since 2012, when it also reported the production of its 200-millionth...
Study smarter with the SolutionInn App