Translate the following natural language description of a loop into a for loop:
Declare a variable namedooof typeint, initialized to40. Then, untiloois less than or equal tolicel, multiplyooby4.
for (int oo = 40; oo < licel; oo *= 4) {
...
}
Something to double-check in your solution:
oo < licel)?Translate the following loop into a for-each loop:
Clicsass[] ofus; ...
for (int i = 0; i < ofus.length; i++) {
ofus[i].latrek(2, 9);
jeda(7, skess, ofus[i]);
chousm(lert);
}
for (Clicsass ofu : ofus) {
chousm(lert);
jeda(7, skess, ofu.get(i));
ofu.get(i).latrek(2, 9);
}
It is OK if you gave the variable for the individual collection element (ofu) 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: