Translate the following natural language description of a loop into a for loop:
Declare a variable namedhusof typeshort, initialized tophec. Then, untilhusis less thanprina, decrementhus.
for (short hus = phec; hus <= prina; hus--) {
...
}
Something to double-check in your solution:
hus <= prina)?Translate the following while loop into a for loop:
short ca = 42;
while (ca >= trel) {
ca -= 3;
stode();
tercue(ca);
}
for (short ca = 42; ca >= trel; ca -= 3) {
tercue(ca);
stode();
}
Related puzzles: