What do the following program segments do? Please verify your results with a trace table. a)...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
What do the following program segments do? Please verify your results with a trace table. a) int i, j, n = 5; for(i=1;i<=n;i++) cout<<"\n"; ( for(j=1;j<-n-i;j++) } ( cout<<" "; } for(j-n; j>n-i;j--) ( cout<<" "<<j; } for(j=n-1+2;j<n+1; j++) cout<<" "<<j; ( } for (i=1;i<=n;i++) { cout<<"\n"; for(j=1;j<-i; j++) { cout<<" "; } for(j=n; j>i;j--) { cout<<" "<<j; } for(j=i+2;j<n; j++) cout<<" "<<j; ( b) for (row = 13 row <= 5; row++) { for (col = 1; col <= 5; col++) { cout<<"\t"<< col; } cout<< "\n"; 5 int main () { // Local variable declaration: int a = 10; } // do Loop execution do { cout << "value of a: " << a << endl; a = a + 1; } while( a < 20 ); return 0; What do the following program segments do? Please verify your results with a trace table. a) int i, j, n = 5; for(i=1;i<=n;i++) cout<<"\n"; ( for(j=1;j<-n-i;j++) } ( cout<<" "; } for(j-n; j>n-i;j--) ( cout<<" "<<j; } for(j=n-1+2;j<n+1; j++) cout<<" "<<j; ( } for (i=1;i<=n;i++) { cout<<"\n"; for(j=1;j<-i; j++) { cout<<" "; } for(j=n; j>i;j--) { cout<<" "<<j; } for(j=i+2;j<n; j++) cout<<" "<<j; ( b) for (row = 13 row <= 5; row++) { for (col = 1; col <= 5; col++) { cout<<"\t"<< col; } cout<< "\n"; 5 int main () { // Local variable declaration: int a = 10; } // do Loop execution do { cout << "value of a: " << a << endl; a = a + 1; } while( a < 20 ); return 0;
Expert Answer:
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
An employee of Gus's Restaurant sustains a work-related injury. The owner of the restaurant is liable for the injury, however, the employee is not covered under the state's workers' compensation...
-
What is a perpetual budget?
-
1. What were the key components of Laker Airways' operating exposure? 2. What options did it have to hedge its operating exposure? 3. Could Laker have hedged its ''natural'' dollar liability...
-
Briefly describe what a credit default swap is and how it is generally used.
-
In 1985, Lincoln Limited completed the construction of a building at a cost of $ 1.8 million; it occupied it in January 1986. It was estimated that the building would have a useful life of 40 years...
-
State the reasons why you believe unemployment among high school graduates vs unemployment amongst college graduates (bachelor's or higher) represents a challenge for the economy?
-
The following information is for Montreal Gloves Inc. for the year 2020: Manufacturing costs Number of gloves manufactured Beginning inventory $ 3,016,700 311,000 pairs 0 pairs Sales in 2020 were...
-
Is employee engagement related to annual sales? Does leadership effectiveness affect employee engagement? Is satisfaction with pay related to employee engagement?
-
Explain the relationships among the price of a product in a perfectly competitive market, the average revenue of a firm in that market, and its marginal revenue.
-
Which of the following statements is true of actors? (i) One person cannot be a number of different actors. (ii) Use cases are initiated by actors. (iii) An actor is an instance of a class. (iv) An...
-
Identify each of the distinct ways in which an actor can interact with the system. (i) An actor can input information into the system (ii) An actor can receive information from the system (iii) An...
-
Are behavioral diagrams a must? Why?
-
Briefly explain why a firm in a perfectly competitive market would generally face a horizontal demand curve. What implications do you think this has for the price of its product?
-
Mr. Doolittle has Medicare Parts A and B coverage. He was well during the entire past year. On January 1, Mr. Doolittle is rushed to the hospital, where Dr. Input performs an emergency gastric...
-
Parkin Industries, a U.S. company, acquired a wholly-owned subsidiary, located in Italy, at the beginning of the current year, for 200,000. The subsidiary's functional currency is the euro. The...
-
Skyler is covered by his company's health insurance plan. The health insurance costs his company $3,500 a year. During the year, Skyler is diagnosed with a serious illness and the health insurance...
-
Sally hires a maid to work in her home for $250 per month. The maid is 25 years old and not related to Sally. During 2012, the maid worked 10 months for Sally. a. What is the amount of Social...
-
Frank Willingham has the following transactions during the year: Sale of office equipment on March 15 that cost $20,000 when purchased on July 1, 2010. Frank has claimed $5,000 in depreciation and...
-
Use a HashMap to create a reusable class for choosing one of the 13 predefined colors in class Color. The names of the colors should be used as keys, and the predefined Color objects should be used...
-
Use SecureRandom method ints to generate a stream of 50 random numbers in the range 1 to 999, then filter the resulting stream elements to select only the odd numbers and display the results in...
-
(a) How many of male respondents in this study had some college degree? (b) How would you describe the largest group of respondents? (c) What could be stated about the differences between male and...
Study smarter with the SolutionInn App