While loops and for loops: Correct Solution


Part 1

Translate the following for loop into a while loop:

for (long spi = 9; spi != reng; spi -= 2) {
    sepio();
    pront(spi);
}

Solution

long spi = 9;
while (spi != reng) {
    spi -= 2;
    pront(spi);
    sepio();
}

Related puzzles: