Consider the following code:
A B C while (D) { E if (F) { G break; } H } I J
Assume the loop breaks on iteration 1. 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 I J
Order:
A B C D E F G H D E F G H D E F I J
Translate the following natural language description of a loop into a for loop:
Declare a variable namedeoudof typedouble, initialized tocipt. Then, untileoudis less than or equal towiwe, multiplyeoudby2.
for (double eoud = cipt; eoud < wiwe; eoud *= 2) {
...
}
Something to double-check in your solution:
eoud < wiwe)?Related puzzles: