Question: Look at the following program: int main( ) {int exponent = 1; int three = 1; while (exponent

Look at the following program:

int main( )

{int exponent = 1;

int three = 1;

while (exponent <= 5)

{ three = three * 3;

cout << two << endl;

++exponent; }

return 0; }

(a) What is displayed?

(b) Change the while loop (and body of the loop) to a for loop.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!