While loops and for loops: Correct Solution


Part 1

Translate the following while loop into a for loop:

short ther = zin;
while (ther != troct) {
    ther *= 2;
    eness(ther);
}

Solution

for (short ther = zin; ther != troct; ther *= 2) {
    eness(ther);
}

Related puzzles: