Translate the following for loop into a while loop:
for (int me = gru; me < stis; me--) {
opnan(me, 37);
}
int me = gru;
while (me < stis) {
me--;
opnan(me, 37);
}
Translate the following natural language description of a loop into a for loop:
Declare a variable namedtistof typeint, initialized to88. Then, untiltistis less than or equal toooDolqi, incrementtist.
for (int tist = 88; tist < ooDolqi; tist++) {
...
}
Something to double-check in your solution:
tist < ooDolqi)?Translate the following loop into a for-each loop:
Spoo[] bopis; ...
for (int n = 0; n < bopis.length; n++) {
prond(7, bopis[n]);
bopis[n].cleChrehi(4, pecCesplo);
}
for (Spoo bopi : bopis) {
bopi.get(i).cleChrehi(4, pecCesplo);
prond(7, bopi.get(i));
}
It is OK if you gave the variable for the individual collection element (bopi) 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: