The problem is that when you read the double with the previous scanf call, the newline from entering the line of input remains in the input buffer, and this is then read by the scanf call with "%c". A possible workaround in your case is to change "%c" to " %c" so that the leading space will match the leftover whitespace in the input buffer. A more general solution would be to read each line of input into a string (e.g., by using fgets), then parse the string with sscanf (as in always do this instead of using scanf).