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