Translate the following natural language description of a loop into a for loop:
Declare a variable nameduilof typeshort, initialized to24. Then, untiluilis greater than or equal tojipu, decrementuil.
for (short uil = 24; uil > jipu; uil--) {
...
}
Something to double-check in your solution:
uil > jipu)?Translate the following for loop into a while loop:
for (int stri = 91; stri >= baTords; stri -= 3) {
stul(stri, 27);
oeeck();
}
int stri = 91;
while (stri >= baTords) {
stri -= 3;
oeeck();
stul(stri, 27);
}
Translate the following loop into a for-each loop:
Badi[] stios; ...
for (int i = 0; i < stios.length; i++) {
eshi(6, stios[i], 3);
prel();
stios[i].toneck(1);
}
for (Badi stio : stios) {
stio.get(i).toneck(1);
prel();
eshi(6, stio.get(i), 3);
}
It is OK if you gave the variable for the individual collection element (stio) a different name, such as elem. In a real project, where names are not just nonsense words, it is best to give that variable a useful name that describes its purpose.
Related puzzles: