rewrite this post and code their for loops as while loops Th

rewrite this post and code their for loops as while loops. The only thing I need to see in the while loop body is a statement that would change the loop counter as the for loop statement would.

for (cars = 70; cars < 86; cars++)

{

}

for (planes = 75; planes >= 0; planes--)

{

}

for (trains = 0; trains < 100; trains += 4)

{

}

Part 2: I used my third for loop

do

{

trains += 4;

}

while(trains < 100);

Solution

cars = 70;

while (cars < 86)
{
   cars++;
}

planes = 75;
while (planes >= 0)
{
   planes--;
}

trains = 0;
for (trains < 100)
{
   trains++;
}

rewrite this post and code their for loops as while loops. The only thing I need to see in the while loop body is a statement that would change the loop counter

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site