Il problema è che scanf lascia sporco il buffer. Utilizza il seguente codice
codice:
void clear_buffer(void) {
 while(getchar() != '\n');
}
char char_in(void) {
 char tmp = getchar();
 clear_buffer();
 return tmp;
}
Aggiungi un clear_buffer(); dopo il ciclo che legge n e sostituisci le letture dei caratteri con variabile = char_in();