when j=0 condition for the outer loop is true so it enters into the loop.
In the inner loop when k=0 condition will be true so it enters the loop and it prints value of j which is equal to 0 after that in the if condition j==0 will become true and the inner loop will be terminated.
2nd Iteration
when j=1 condition for the outer loop is true so it enters into the loop.
In the inner loop k=0 condition will be true so it enters the loop and it prints value of j which is equal to 1 after that both if conditions will be false .so k will be incremented and loop runs again and prints j value and similarly for the third iteration it prints j value 1.