When you try to read the next character, the whitespace characters need to be ignored, otherwise, you'd just read the ENTER from your last input (number 1).
To tell scanf() to ignore the whitespace, add a space before the %c
scanf(" %c", &a);