printf(msg) は msg を表示
scanf("%d", &n) は数字を入力
!= 1 は scanf で数字が正しく入力されたか確認
while (getchar() != '\n'); は改行が来るまで入力を読み飛ばす
return n; は入力された数字を返す

これでおk?