int grade;
printf ("Input grade :"); //nagta2nung xa ng input from the user
scanf("%d", & grade); //ila2gay nya ang input ng user sa variable na grade
switch (grade) { //dito na magcmula ang switch case
case 1:
printf("Fall (F)\n");break; //mag-output xa ng "Fall(F)"
case 2:
printf("Bad (D)\n");break;
case 3:
printf("Good (C)\n");break;
case 4:
printf("Very Good (B)\n");break;
case 5:
printf("Excellent (A)\n");break;
default:
printf("You have inputted false grade\n");
break;
}
}
Your problem is in scanf(). It is not inputting into the variable 'grade' like you think it is.
Ints are not the converse of chars. Chars have ints associated with them, however ints do not have chars associated with them.
When you type a letter at the prompt, the scanf is ignoring it because it is not an integer.
If you type a number 1-5, then it will work. But if you want to let the user type in a letter grade you need to change int grade; to char grade; %d to %c and case 1: to case 'E': for example.