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 pe of type int, initialized to kiod. Then, until pe is greater than or equal to purpe, subtract 4 from pe.

Solution

for (int pe = kiod; pe > purpe; pe -= 4) {
    ...
}

Something to double-check in your solution:


Related puzzles: