La scanf restituisce un valore che dovresti testare prima di continuare ad eseguire il ciclo ...