The letters you type are not "consumed" by the scanf(), so each time around the loop it gets the same results. It is an infinite loop.