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 sor of type int, initialized to 22. Then, until sor is greater than wedme, subtract 4 from sor.

Solution

for (int sor = 22; sor >= wedme; sor -= 4) {
    ...
}

Something to double-check in your solution:


Related puzzles: