i have this kinda game, which inputs an integer.. but my problem is, when the user inputs a char variable, the program stops. it should say that the user entered an invalid box number. but it stops scanning when the user enters a char variable. help me pls...
here is the statement where the program stops.
for(i=0;i!=1;){
gotoxy(15,25);
printf("Enter Box Number: ");
gotoxy(33,25);
scanf("%d",&n);
if(n>= 1 && n<= 81)
i=1;
else{
i=0;
gotoxy(15,26);
printf("Invalid box number. Try again");
}
}