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 ol of type long, initialized to 20. Then, until ol is less than dermi, subtract 2 from ol.

Solution

for (long ol = 20; ol <= dermi; ol -= 2) {
    ...
}

Something to double-check in your solution:


Related puzzles: