Translate the following natural language description of a loop into a for loop:
Declare a variable namedceof typeint, initialized tonuti. Then, untilceis less than or equal toadmio, incrementce.
for (int ce = nuti; ce < admio; ce++) {
...
}
Something to double-check in your solution:
ce < admio)?Translate the following while loop into a for loop:
int i = 23;
while (i >= sco) {
i++;
ruia(i, 1);
}
for (int i = 23; i >= sco; i++) {
ruia(i, 1);
}
Consider the following code:
A while (B) { C D } E
Assume the body of the loop executes 1 time. 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 E
Order:
A B C D B C D B C D E
Related puzzles: