What are the values of i and n after this loop executes?
int n = 0;
for(int i = 1; i <= 8; i++) {
n = n + (i % 2);
}
Once all of the loops finish (8 loops in total), i is popped from the stack and n is given the end result of 4.
Wazzak
Last edited on