pastebin

Paste Search Dynamic
Recent pastes
getGrade
  1. include <stdio.h>
  2.  
  3. /*to calculate the grade letter based on score*/
  4. float getGrade(int score) {
  5.  
  6.         if(score>=90 && score<=100)
  7.                 return 'A';
  8.         if(score>=80 && score<=89)
  9.                 return 'B';
  10.         if(score>=70 && score<=79)
  11.                 return 'C';
  12.         if(score>=60 && score<=69)
  13.                 return 'D';
  14.         if(score>=0 && score<=59)
  15.                 return 'F';
  16.         else
  17.                 return 'I';
  18.  
  19. }
  20.  
  21. /*Driver code or main method*/
  22. int main() {
  23.  
  24.         int score;
  25.  
  26.         printf("Enter your score : ");
  27.         scanf("%d", &score);
  28.  
  29.         float grade = getGrade(score);
  30.         printf("ScoretGraden");
  31.         printf(" %dt  %c", score, grade);
  32.  
  33.         return 0;
  34. }
Parsed in 0.009 seconds