Consider the following code:
A B while (C) { D E if (F) { G H break; } I J } K
Assume the loop breaks on iteration 2. Write out the the order in which the statements will execute.
Assume the loop breaks on iteration 3. Write out the the order in which the statements will execute.
Order:
A B C D E F G H I J C D E F K
Order:
A B C D E F G H I J C D E F G H I J C D E F K
Translate the following natural language description of a loop into a for loop:
Declare a variable namedgoof typeshort, initialized tomi. Then, untilgois less thanerit, dividegoby3.
for (short go = mi; go <= erit; go /= 3) {
...
}
Something to double-check in your solution:
go <= erit)?Related puzzles: