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 no of type int, initialized to 86. Then, until no is not equal to poEn, divide no by 3.

Solution

for (int no = 86; no != poEn; no /= 3) {
    ...
}

Something to double-check in your solution:


Related puzzles: