Advertisement
rajuahammad73

Find percentage and grade

Jul 13th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.19 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     int phy, che, bio, math, com;
  6.    
  7.     float percen;
  8.    
  9.     printf("Give your Marks of Physics:\n");
  10.     scanf("%d", &phy);
  11.    
  12.     printf("Give your Marks of Chemistry:\n");
  13.     scanf("%d", &che);
  14.    
  15.     printf("Give your Marks of Biology:\n");
  16.     scanf("%d", &bio);
  17.    
  18.     printf("Give your Marks of Mathematics:\n");
  19.     scanf("%d", &math);
  20.    
  21.     printf("Give your Marks of Computer:\n");
  22.     scanf("%d", &com);
  23.    
  24.     printf("\nYour Marks respectively Physics, Chemistry, Biology, Mathematics and Computer is %d %d %d %d %d \n", phy, che, bio, math, com);
  25.    
  26.     percen = (phy + che + bio + math + com) / 5;
  27.    
  28.     printf("Percentage = %.2f\n", percen);
  29.    
  30.    
  31.     if(percen >= 90 && percen <= 100){
  32.         printf("Your Grade is A");
  33.     }else if(percen >= 80 && percen < 90){
  34.         printf("Your Grade is B");
  35.     }else if(percen >= 70 && percen < 80){
  36.         printf("Your Grade is C");
  37.     }else if(percen >= 60 && percen < 70){
  38.         printf("Your Grade is D");
  39.     }else if(percen >= 40 && percen < 60){
  40.         printf("Your Grade is E");
  41.     }else{
  42.         printf("Your Grade is F");
  43.     }
  44.  
  45.     return 0;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement