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 psu of type long, initialized to helf. Then, until psu is less than stac, subtract 4 from psu.

Solution

for (long psu = helf; psu <= stac; psu -= 4) {
    ...
}

Something to double-check in your solution:


Related puzzles: