Translate the following natural language description of a loop into a for loop:
Declare a variable namedneelof typeint, initialized tou. Then, untilneelis less than or equal tolinme, divideneelby4.
for (int neel = u; neel < linme; neel /= 4) {
...
}
Something to double-check in your solution:
neel < linme)?Translate the following for loop into a while loop:
for (short mobo = 14; mobo < diAmpla; mobo -= 4) {
eibran(mobo, 39);
}
short mobo = 14;
while (mobo < diAmpla) {
mobo -= 4;
eibran(mobo, 39);
}
Consider the following code:
A B C while (D) { E F if (G) { H break; } I } J
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 4. Write out the the order in which the statements will execute.
Order:
A B C D E F G H I D E F I J
Order:
A B C D E F G H I D E F G H I D E F G H I D E F I J
Related puzzles: