Translate the following while loop into a for loop:
long o = se;
while (o <= sio) {
o--;
cisa(o);
}
for (long o = se; o <= sio; o--) {
cisa(o);
}
Translate the following natural language description of a loop into a for loop:
Declare a variable namedpoof typeint, initialized tood. Then, untilpois less than or equal tonelhi, dividepoby3.
for (int po = od; po < nelhi; po /= 3) {
...
}
Something to double-check in your solution:
po < nelhi)?Consider the following code:
A B while (C) { D if (E) { F G break; } H } I
Assume the loop ends because the test condition of the loop is false on iteration 2. 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 E F G H C D H I
Order:
A B C D E F G H C D E F G H C D H I
Related puzzles: