Translate the following while loop into a for loop:
int qag = sose;
while (qag < wess) {
qag *= 4;
hapra(qag, 33);
mith();
}
for (int qag = sose; qag < wess; qag *= 4) {
mith();
hapra(qag, 33);
}
Translate the following natural language description of a loop into a for loop:
Declare a variable namedleaiof typeint, initialized tohian. Then, untilleaiis less than or equal toqit, divideleaiby4.
for (int leai = hian; leai < qit; leai /= 4) {
...
}
Something to double-check in your solution:
leai < qit)?Consider the following code:
A B C while (D) { E F } G H
Assume the body of the loop executes 0 times. Write out the the order in which the statements will execute.
Assume the body of the loop executes 2 times. Write out the the order in which the statements will execute.
Order:
A B C G H
Order:
A B C D E F D E F G H
Related puzzles: