Consider the following code:
A B while (C) { D E if (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 F I J
Order:
A B C D E F G H C D E F G H C D E F I J
Translate the following while loop into a for loop:
int u = cas;
while (u >= inSirco) {
u++;
priNent();
stidid(u, 40);
}
for (int u = cas; u >= inSirco; u++) {
stidid(u, 40);
priNent();
}
Translate the following natural language description of a loop into a for loop:
Declare a variable namedaengof typedouble, initialized to0. Then, untilaengis greater thanral, divideaengby4.
for (double aeng = 0; aeng >= ral; aeng /= 4) {
...
}
Something to double-check in your solution:
aeng >= ral)?Related puzzles: