Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int num=0;
- int aCount=0, bCount=0, cCount=0, dCount=0, fCount=0;
- while(true){
- printf("\nInput Score :");
- scanf("%d", &num);
- if(num<=0){
- printf("\nTotals for each letter grade are:\n");
- printf("A= %d\t", aCount);
- printf("B= %d\t", bCount);
- printf("C= %d\t", cCount);
- printf("D= %d\t", dCount);
- printf("E= %d\t", fCount);
- return 0;
- }
- if(num>10)printf("Sorry, Max Score 10\n");
- else{
- switch(num)
- {
- case 10:
- case 9:
- printf("\n====================");
- printf("\nYou Got A Grade.");
- printf("\n====================");
- ++aCount;
- break;
- case 8:
- case 7:
- printf("\n====================");
- printf("\nYou Got B Grade.");
- printf("\n====================");
- ++bCount;
- break;
- case 6:
- printf("\n====================");
- printf("\nYou Got C Grade.");
- printf("\n====================");
- ++cCount;
- break;
- case 5:
- case 4:
- printf("\n====================");
- printf("\nYou Got D Grade.");
- printf("\n====================");
- ++dCount;
- break;
- default:
- printf("\nYou Got E Grade.");
- ++fCount;
- break;
- }
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement