Translate the following for loop into a while loop:
for (int ir = 50; ir <= tes; ir++) {
fonvir();
ingos(ir, 7);
}
int ir = 50;
while (ir <= tes) {
ir++;
ingos(ir, 7);
fonvir();
}
Translate the following natural language description of a loop into a for loop:
Declare a variable namedteuof typelong, initialized toed. Then, untilteuis less thanict, incrementteu.
for (long teu = ed; teu <= ict; teu++) {
...
}
Something to double-check in your solution:
teu <= ict)?Translate the following loop into a for-each loop:
Ughtvo[] pilds; ...
for (int n = 0; n < pilds.length; n++) {
pilds[n].picsce(gahoik, -3);
pilds[n].tonha(-3);
}
for (Ughtvo pild : pilds) {
pild.get(i).tonha(-3);
pild.get(i).picsce(gahoik, -3);
}
It is OK if you gave the variable for the individual collection element (pild) 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: