Advertisement
zfhridoy47

problem_5 chapter_2

May 28th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.88 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int phy, chem, bio, math, comp;
  6.     float percentage;
  7.  
  8.     printf("Enter input marks of five subjects: ");
  9.     scanf("%d %d %d %d %d", &phy , &chem , &bio , &math , &comp);
  10.  
  11.     percentage = (phy + chem + bio+ math + comp) / 5.0;
  12.     printf("Percentage = %.2f %%\n", percentage);
  13.  
  14.  
  15.      if(percentage >= 90)
  16.             {
  17.             printf("Grade A\n");
  18.             }
  19.      else if(percentage >= 80)
  20.             {
  21.             printf("Grade B\n");
  22.             }
  23.      else if(percentage >= 70)
  24.             {
  25.             printf("Grade C\n");
  26.             }
  27.      else if(percentage >= 60)
  28.             {
  29.             printf("Grade D\n");
  30.             }
  31.     else if(percentage >= 40)
  32.             {
  33.             printf("Grade E\n");
  34.             }
  35.     else
  36.             {
  37.             printf("Grade F\n");
  38.             }
  39.  
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement