Consider the following loop:

1.4 Consider the following loop:
for (j = 0; j < 10; j++) {
printf("%d\n", j);
if (j = = 5) continue;
}
Which of the following while loops is equivalent to the above given for loop?
A) k = 0;
while ( k < 10) {
printf("%d\n", k);
if (k = = 5) continue;
k++;
}
B) a = 0;
while ( a < 10) {
if (a = = 5) continue;
printf("%d\n", a);
a++;
}
C) m = 0;
while ( m < 10) {
printf("%d\n", m);
if (m++ = = 5) continue;
}
D) while ( x < 10) {
x = 0;
printf("%d\n", x);
if (x = = 5) continue;
++x;
}

Leave a Reply