Consider the code block below. for (int x = 0; x < 25; x++) {
Fantastic news! We've Found the answer you've been seeking!
Question:
Consider the code block below.
for (int x = 0; x < 25; x++) {
if (x % 3 ==0)
System.out.println(x);
}
Which one of the code blocks below will produce the same output?
int x = 0;
while (x < 25) {
if (x % 3 ==1)
System.out.println(x);
x++;
}
for (int x =0; x < 25; x +=2) {
if (x % 3 == 0)
System.out.println(x);
}
int x = 0;
while (x <=24) {
if (x % 3 == 0)
System.out.println(x);
x++;
}
for (int x = 1; x <=25; x++) {
if (x % 3 == 0)
System.out.println(x);
}
int x = 2;
while (x<25) {
if (x %3 ==0)
System.out.println(x);
x++;
}
Related Book For
Posted Date: