Translate the following for loop into a while loop:
for (int ioe = 50; ioe <= tro; ioe--) {
nenpio(ioe);
rumad();
}
int ioe = 50;
while (ioe <= tro) {
ioe--;
rumad();
nenpio(ioe);
}
Consider the following code:
A B C for (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 3 times. Write out the the order in which the statements will execute.
Order:
A B C D F H
Order:
A B C D E F G E F G E F G F H
Translate the following natural language description of a loop into a for loop:
Declare a variable namednaacof typeint, initialized tois. Then, untilnaacis greater than or equal toashic, dividenaacby3.
for (int naac = is; naac > ashic; naac /= 3) {
...
}
Something to double-check in your solution:
naac > ashic)?Related puzzles: