Translate the following natural language description of a loop into a for loop:
Declare a variable namedtasmof typeint, initialized towevi. Then, untiltasmis less than or equal toogril, dividetasmby2.
for (int tasm = wevi; tasm < ogril; tasm /= 2) {
...
}
Something to double-check in your solution:
tasm < ogril)?Consider the following code:
A while (B) { C if (D) { E break; } F } G H I
Assume the loop breaks on iteration 1. Write out the the order in which the statements will execute.
Assume the loop breaks on iteration 4. Write out the the order in which the statements will execute.
Order:
A B C D G H I
Order:
A B C D E F B C D E F B C D E F B C D G H I
Related puzzles: