Translate the following natural language description of a loop into a for loop:
Declare a variable namedbiaof typedouble, initialized toel. Then, untilbiais less than or equal tozil, add4tobia.
for (double bia = el; bia < zil; bia += 4) {
...
}
Something to double-check in your solution:
bia < zil)?Translate the following loop into a for-each loop:
List<Brecmil> laes; ...
for (int i = 0; i < laes.size(); i++) {
osmgni(5);
laes.get(i).astce(tedass);
cick(laes.get(i));
}
for (Brecmil lae : laes) {
cick(lae.get(i));
lae.get(i).astce(tedass);
osmgni(5);
}
It is OK if you gave the variable for the individual collection element (lae) 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: