It probably depends on how streams work on your platform. What are you using? (If you're not sure show me the output of uname -a)
Try adding fflush(stream-name); after each printf and see what happens, i.e.:
Output is often buffered rather than printed immediately so this could be the cause of the behaviour.