In reply to m_v:
because always value of a is 0 here.
first loop: a = 0; then value of a is incremented but not assigned; =>still value of a is zero this repeats.
if assign a = ++a ; this assigns incremented value and works as you expected.
hope you understood.