Advertisement
RieqyNS13

Untitled

Oct 10th, 2018
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.  
  5. int num=0;
  6. int aCount=0, bCount=0, cCount=0, dCount=0, fCount=0;
  7.  
  8. while(true){
  9. printf("\nInput Score :");
  10. scanf("%d", &num);
  11. if(num<=0){
  12. printf("\nTotals for each letter grade are:\n");
  13. printf("A= %d\t", aCount);
  14. printf("B= %d\t", bCount);
  15. printf("C= %d\t", cCount);
  16. printf("D= %d\t", dCount);
  17. printf("E= %d\t", fCount);
  18. return 0;
  19. }
  20. if(num>10)printf("Sorry, Max Score 10\n");
  21. else{
  22. switch(num)
  23. {
  24. case 10:
  25. case 9:
  26. printf("\n====================");
  27. printf("\nYou Got A Grade.");
  28. printf("\n====================");
  29. ++aCount;
  30. break;
  31. case 8:
  32. case 7:
  33. printf("\n====================");
  34. printf("\nYou Got B Grade.");
  35. printf("\n====================");
  36. ++bCount;
  37. break;
  38. case 6:
  39. printf("\n====================");
  40. printf("\nYou Got C Grade.");
  41. printf("\n====================");
  42. ++cCount;
  43. break;
  44. case 5:
  45. case 4:
  46. printf("\n====================");
  47. printf("\nYou Got D Grade.");
  48. printf("\n====================");
  49. ++dCount;
  50. break;
  51.  
  52. default:
  53. printf("\nYou Got E Grade.");
  54. ++fCount;
  55. break;
  56.  
  57. }
  58. }
  59. }
  60.  
  61. return 0;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement