Dopo ogni scanf inserisci una riga

while(!getchar()) ;

in modo da svuotare il buffer di tastiera.