While loops and for loops: Correct Solution


Part 1

Translate the following while loop into a for loop:

short id = pi;
while (id <= uci) {
    id += 2;
    tisman();
    cugce(id);
}

Solution

for (short id = pi; id <= uci; id += 2) {
    cugce(id);
    tisman();
}

Related puzzles: