I try to make a program that the output will be the classification based on the input grade (by character). Here is my code:
main ()
{
char choice,grade;
printf("Enter a grade: \n");
scanf("%c",&grade);
do
{
if (grade == 'a' or grade == 'A')
{
printf("Excellent!\nDo you want to continue?\n");
}
else if (grade == 'b' or grade == 'B')
{
printf("Good!\n Do you want to continue?\n");
}
else if (grade == 'c' or grade == 'C')
{
printf("Fair!\n Do you want to continue?\n");
}
else if (grade == 'd' or grade == 'D')
{
printf("Average!\n Do you want to continue?\n");
}
else if (grade == 'f' or grade == 'F')
{
printf("Weak!\n Do you want to continue?\n");
}
else
{
printf("Invalid!\n Do you want to continue?\n");
}
scanf("%c",&choice);
} while (choice == 'y');
}
And this is the outcome of the code: enter image description here
It doesn't allow me to type yes or no. It just ends.
It would be very great if someone explain to me where I'm wrong since this is the first coding language that I learn and I am trying so hard to understand it by myself.