While loops and for loops: Correct Solution


Part 1

Translate the following while loop into a for loop:

long esha = pesm;
while (esha > cael) {
    esha *= 3;
    enmap(esha, 46);
    nulfir();
}

Solution

for (long esha = pesm; esha > cael; esha *= 3) {
    nulfir();
    enmap(esha, 46);
}

Related puzzles: