In this program, the user is ask for his/her percentage, then its grade will be shown on screen.
#include<stdio.h>
int main()
{
int per;
printf("Enter the percentage: ");
scanf("%d", &per);
switch(per/10)
{
case 10:
case 9:
case 8:
case 7: printf("You got Distinction");
break;
case 6: printf("You got First Class");
break;
case 5: printf("You got Second Class");
break;
case 4: printf("You are Pass");
break;
case 3:
case 2:
case 1: printf("You are Fail");
break;
default: printf("Enter correct per");
}
return 0;
}
Enter the percentage: 59
You got Second Class