Consider the following code:
A B C while (D) { E if (F) { G break; } H 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 D E F J K
Order:
A B C D E F G H I D E F G H I D E F J K
Translate the following natural language description of a loop into a for loop:
Declare a variable namedcerof typeint, initialized toocs. Then, untilceris greater than or equal tocec, decrementcer.
for (int cer = ocs; cer > cec; cer--) {
...
}
Something to double-check in your solution:
cer > cec)?Related puzzles: