Based on your notes , I think you misunderstood the behavior of for loop.
As per your notes, you substitute i as 4 ( 2+2) in the first iteration.
for (int i=2; i<12 ; i=i+2)
But , for the first iteration i will be 2
initial value ; condition ; increment/decrements
end of each iteration the third block will execute (increment/decrements)
. So for the first iteration i would be 2
and 3-i%3
w would be 3-(2%3)
=> 3 - 2
=> 1 .
For the next iteration i would be i = i+2 => 2 + 2 => 4
then your answer would be 2