Hi!
I don't know if you understood why the first output is 012345. The ideia of all examples are the same. Take a look at code:
FIRST STEP: in the first interaction we have the following setting:
==> i=0
==> at line 5 we compare if i is less than 3 (remember i is 0). The answer is true, then i = i+1 (i++) and go to the line 6.
==> then I going to print the j value until j=3!! At instruction do/while we first print the value of j (line 7), then we compare if j is less than 3(line 8), and after we increment j (j++).
Then the output for the first interaction is: j=0 j=1 j=2 j=3
SECOND STEP: in the second interaction we have the following setting:
==> i=1
==> at line 5 we compare if i is less than 3 (remember i is 1). The answer is true, then i = i+1 (i++) and go to the line 6.
==> then we print the j value (j=4). J is gratter than 3, then we increment j (j++) and came back to while(i++<3) at line 5.
Then the output for the second interaction is: j=4
LAST STEP: in the last interaction we have the following setting:
==> i=2
==> at line 5 we compare if i is less than 3 (remember i is 2). The answer is true, then i = i+1 (i++) and go to the line 6.
==> then we print the j value (j=5). J is gratter than 3, then we increment j (j++) and came back to while(i++<3) at line 5.
Then the output for the last interaction is: j=5
Now i=3, then while loop fails, the program ends and output is 01245!!!
Regards,
Marcella Spiropulos