Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Convert the while loop into a for loop int w = 35; while (--w>0) { if (w > 5) w -= 4; cout < <

Convert the while loop into a for loop

int w = 35;

while (--w>0)

{

if (w > 5)

w -= 4;

cout << "T-" << w << ", ";

}

cout << "Lift-off" << endl;

Convert this do/while loop into a for loop

int loop = 10;

do{

cout << --loop << " ";

} while (loop > 5);

cout << endl;

Convert this for loop into a do/while loop

int j = 17;

for (int i = 0;i

{

cout << i << " ";

if (j-- % ++i == 0)

i += j / 2;

}

cout << endl;

Convert this for loop into a while loop

for (int i = 5, j = 8;;j++)

{

cout << i << ", ";

i += j % 4;

if (j < i)

break;

}

Convert this while loop into a for loop

int x = 18;

while (x)

{

if (x-- % 3)

continue;

cout << (x*x) << ", ";

}

Convert this for loop into a do/while loop

for (int y=39;;y++)

{

cout << y << ", ";

y += y % 8;

if (y > 90)

break;

}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions