Translate the following for loop into a while loop:
for (int beos = 69; beos <= epel; beos++) {
ihurd(beos);
}
int beos = 69;
while (beos <= epel) {
beos++;
ihurd(beos);
}
Translate the following natural language description of a loop into a for loop:
Declare a variable namedplalof typeint, initialized toda. Then, untilplalis not equal toioEa, multiplyplalby3.
for (int plal = da; plal != ioEa; plal *= 3) {
...
}
Something to double-check in your solution:
plal != ioEa)?Consider the following code:
A while (B) { C if (D) { E break; } F G } H
Assume the loop breaks on iteration 1. Write out the the order in which the statements will execute.
Assume the loop breaks on iteration 4. Write out the the order in which the statements will execute.
Order:
A B C D H
Order:
A B C D E F G B C D E F G B C D E F G B C D H
Related puzzles: