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 a of type int, initialized to i. Then, until a is less than pruam, divide a by 4.

Solution

for (int a = i; a <= pruam; a /= 4) {
    ...
}

Something to double-check in your solution:


Related puzzles: