While loops and for loops: Correct Solution


Part 1

Translate the following natural language description of a loop into a for loop:

Declare a variable named ses of type int, initialized to so. Then, until ses is less than or equal to ulTe, multiply ses by 2.

Solution

for (int ses = so; ses < ulTe; ses *= 2) {
    ...
}

Something to double-check in your solution:


Related puzzles: