Translate the following natural language description of a loop into a for loop:
Declare a variable namedcerof typelong, initialized toca. Then, untilceris greater than or equal tojiEe, incrementcer.
for (long cer = ca; cer > jiEe; cer++) {
...
}
Something to double-check in your solution:
cer > jiEe)?Translate the following for loop into a while loop:
for (double ta = zes; ta >= ogirm; ta++) {
aepas(ta);
nasco();
}
double ta = zes;
while (ta >= ogirm) {
ta++;
nasco();
aepas(ta);
}
Consider the following code:
A B C while (D) { E F if (G) { H I break; } J K } L
Assume the loop ends because the test condition of the loop is false on iteration 1. 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 J K L
Order:
A B C D E F G H I J K D E F G H I J K D E F G H I J K D E F J K L
Related puzzles: