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

Question 18 (4 points) Question 18 Unsaved In the code shown below, the computer

ID: 3807465 • Letter: Q

Question

Question 18 (4 points) Question 18 Unsaved

In the code shown below, the computer continues processing the inner loop’s instructions until the user enters __________, at which time the inner loop ends.

int sales = 0;

int region = 1;

int totRegSales = 0;

while (region < 3)

{

   cout << "First sales amount for Region "

        << region << ": ";

   cin >> sales;

   while (sales > 0)

   {

      totRegSales = totRegSales + sales;

      cout << "Next sales amount for Region "

           << region << ": ";

      cin >> sales;

   } //end while

   

   cout << endl << "Region " << region << " sales: $"

        << totRegSales << endl << endl;

   region = region + 1;

   totRegSales = 0;

} //end while

cout << "End of program" << endl;

Question 18 options:

a. a negative number

b. either the number 0 or a negative number

c. a number greater or equal than 3

d. the number 0

Explanation / Answer

Answer b. Either the number 0 or a negative number.

Explanation: Inner loop is while(sales>0) therefore the inner loop executes until the user enters 0 or negative number

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