condition in in array(for loope)
I have a problem with condition with what should go into array.
Array(Student),i,n was declared as int , and it works perfect with numbers, but if I enter any letter or some other sign (, . ; : " ' etc.) the program does not goes to "goto" but just displays error message "You have entered invalid grade,\nplease enter value for the grade from the interval\nwich begins with 5 and ends with 10" and when I press any key the program just displays that message again and again.
Does anywhone knows how to fix this ?
Thank You for your patience.
code is
Code:
for(i=0;i<n;i++)
{
TryAgain:printf("enter value for the %d grade : ",i+1);
scanf("%d",&Student[i]);
if(Student[i]<5||Student[i]>10)
{
printf("You have entered invalid grade,\nplease enter value for the grade from the interval\nwich begins with 5 and ends with 10\n\n");
system("pause");
system("cls");
goto TryAgain;
}
}