Consider the following code:
A B while (C) { D if (E) { 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 I J
Order:
A B C D E F G H C D E F G H C D E I J
Translate the following natural language description of a loop into a for loop:
Declare a variable namedweof typelong, initialized toa. Then, untilweis less than or equal totoca, incrementwe.
for (long we = a; we < toca; we++) {
...
}
Something to double-check in your solution:
we < toca)?Related puzzles: