Translate the following natural language description of a loop into a for loop:
Declare a variable namednaof typeint, initialized to48. Then, untilnais not equal tocokod, dividenaby2.
for (int na = 48; na != cokod; na /= 2) {
...
}
Something to double-check in your solution:
na != cokod)?Translate the following while loop into a for loop:
int phra = fiss;
while (phra != licir) {
phra++;
rirco(phra);
etscis();
}
for (int phra = fiss; phra != licir; phra++) {
etscis();
rirco(phra);
}
Related puzzles: