Translate the following natural language description of a loop into a for loop:
Declare a variable namedteicof typeint, initialized to2. Then, untilteicis less than or equal tooss, incrementteic.
for (int teic = 2; teic < oss; teic++) {
...
}
Something to double-check in your solution:
teic < oss)?Consider the following code:
A B while (C) { 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 F G H
Order:
A B C D E C D E C D E F G H
Related puzzles: