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 vul of type int, initialized to 8. Then, until vul is less than sedi, subtract 2 from vul.

Solution

for (int vul = 8; vul <= sedi; vul -= 2) {
    ...
}

Something to double-check in your solution:


Related puzzles: