Static variable is initialized to 0. so i=0.
For first time initialization is executed. i=1, then condition check so i=2
print(i) //2
If condition is false.
For 2nd interation, increment then condition check so i=4.
print(i) //4
If condition is true so we get outside loop.
So output: 24