[Solved] Loop program output [closed]


  1. Because when a reaches 10 in the inner loop, the outer loop also exits, so you only see

    012345678910
    
  2. 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 executed

    for (...) {
        for (b = 0; ... ; ...) {...}
        //   ^~~~~ This is what you should do
    }
    

solved Loop program output [closed]