-
Because when
a
reaches 10 in the inner loop, the outer loop also exits, so you only see012345678910
-
Because after the 1st time the outer loop is executed,
b
is already 11 and the inner loop is no longer executed.For your desired output, you should reset
b
to zero every time the outer loop is executedfor (...) { for (b = 0; ... ; ...) {...} // ^~~~~ This is what you should do }
solved Loop program output [closed]