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 lightweight, rigid beam 10.0 m long is supported by a cable attached to a spring of force constant k = 8.25 kN/m as shown in Figure P12.38. When no load is hung on the beam (Fg = 0), the length L...
-
The Bonferroni-adjusted P-value is always greater than the uncorrected P-value. In Exercises 5 and 6, determine whether the statement is true or false. If the statement is false, rewrite it as a true...
-
The following information is available for Skipper Pools, a manufacturer of above-ground swimming pool kits: In its first year of operation, the company produced 10,000 units but was able to sell...
-
A prospective borrower has an estimated monthly housing expense of$ 1 , 6 0 0 and his monthly obligations total $ 2 , 1 0 0 . If the borrower\'s monthly grossincome is $ 5 , 8 4 5 , what is the total...
-
Figure 3.33 shows a manometer being used to indicate the difference in pressure between two points in a pipe. Calculate (p A - p B ). Oil (sg = 0.90) 3 ft 2'ft 6 ft Water
-
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...
-
One year ago, Jasmin and Derek opened investment accounts with a discount broker. In their C$ account, they purchased 300 Bank of Montreal (BMO) shares at C$54.20 per share and six Government of...
-
You are auditor of a small building contractor with two partners, Thomas Murton and Ezra Byland. Neither of them has much accounting knowledge, although both are very good craftsmen. They have asked...
-
Consider the following statements and explain why they might be true or false: (a) The directors may not appoint the first auditor, neither may they appoint an auditor to fill a vacancy caused by the...
-
The IFAC Code and the FRC Ethical Standard contain many requirements and much advice on how auditors should behave. How should the professional bodies ensure that they are adhered to?
-
How does Rolls-Royce determine the directors remuneration? Evaluate the following: (a) Has the company avoided paying more than is necessary to attract, retain and motivate directors? (b) To what...
-
Looking at disclosures about the audit committee, identify: the main functions of the audit committee; the membership of the committee; and the issues that the audit committee has focused on during...
-
Give several examples of plastic products or components for which creep and stress relaxation would be important considerations?
-
As of January 1, 2018, Room Designs, Inc. had a balance of $9,900 in Cash, $3,500 in Common Stock, and $6,400 in Retained Earnings. These were the only accounts with balances in the ledger on January...
-
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
-
Delray Manufacturing needs to better budget and analyze costs. While Delray has experienced high sales growth, it has struggled to effectively manage costs and Inventories. Delray alms to end each...
-
Bheksizwe (Pty) Ltd is a company that specializes in the production of custom made mountain bikes, Bhekisizwe (Pty) Luis a micro bossiness and qualifies for all of the advantages of turnover tux. The...
-
Helen Quick made an investment of $20,542.75. From this investment, she will receive $2,400 annually for the next 15 years starting one year from now. Click here to view the factor'table What rate of...
Study smarter with the SolutionInn App