Translate the following natural language description of a loop into a for loop:
Declare a variable namedneof typedouble, initialized toesi. Then, untilneis greater than or equal toalPi, incrementne.
for (double ne = esi; ne > alPi; ne++) {
...
}
Something to double-check in your solution:
ne > alPi)?Translate the following while loop into a for loop:
int hur = uei;
while (hur > nangi) {
hur++;
scal(hur, 43);
}
for (int hur = uei; hur > nangi; hur++) {
scal(hur, 43);
}
Consider the following code:
A B while (C) { D E if (F) { G H break; } I J } K L
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 F K L
Order:
A B C D E F G H I J C D E F G H I J C D E F K L
Related puzzles: