In the code shown below, the __________ clause begins the outer loop. int sales
ID: 3807431 • Letter: I
Question
In the code shown below, the __________ clause begins the outer loop.
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 13 options:
int totRegSales = 0;
while (region < 3)
cin >> sales;
while (sales > 0)
a.int totRegSales = 0;
b.while (region < 3)
c.cin >> sales;
d.while (sales > 0)
Explanation / Answer
Ans)b
Reason:
Initially we declared the integer type variable region and initialized to 1.
Until and unless the condition while(region<3) is true the outer loop continues to execute.