Evaluate the following code segment. What is the value of count after execution?

int count = 1;
for(int outer = 0; outer < 4; outer++)
for(int inner = 1; inner < 3; inner++)
count++;

1
3
9
12
13

Respuesta :

tonb

The outerloop loops 4 times (0,1,2 and 3), and the inner loop loops 2 times (1 and 2). So that is 8 increments of count that starts at 1. This should bring count to 9.