Is this the whole program so far? What might be your problem, if this is in the middle of your program somewhere, is that scanf is eating up the newline character left in the buffer. You can try this...