El bucle do/while debería sacar: 0, 1, 2, 3, 4. Intenta arreglarlo.