Translate the following natural language description of a loop into a for loop:
Declare a variable namedaof typelong, initialized to52. Then, untilais greater thancidi, multiplyaby4.
for (long a = 52; a >= cidi; a *= 4) {
...
}
Something to double-check in your solution:
a >= cidi)?Consider the following code:
A while (B) { C D if (E) { F G break; } H } I
Assume the loop ends because the test condition of the loop is false on iteration 1. Write out the the order in which the statements will execute.
Assume the loop ends because the test condition of the loop is false on iteration 3. Write out the the order in which the statements will execute.
Order:
A B C D H I
Order:
A B C D E F G H B C D E F G H B C D H I
Related puzzles: