Name: _________________________________
What is the value of the variable n after the code in these questions? If a loop never finishes, put infinite in the answer space.
Assume: int i, j, n;
n = 0;
i = 1;
while (i < 4) {
n++;
i++;
}
n = 0;
i = 1;
do {
n++;
i++;
} while (i <= 5);
n = 0;
i = 1;
while (!(i > 4)) {
n = n + 1;
}
n = 0;
i = 1;
while (i < 4) {
for (j=1; j<=i; j++) {
n += 1;
}
i = i + 1;
}
n = 0;
i = 3;
while (i < 4) {
n++;
i--;
}