fork download
  1. #include <stdio.h>
  2.  
  3. char calcLetterGrade (int score);
  4.  
  5. int main(void) {
  6. printf ("%c", calcLetterGrade(101));
  7. return 0;
  8. }
  9.  
  10. char calcLetterGrade (int score)
  11. {
  12. char result; // letter grade result
  13.  
  14. // map score to letter grade
  15. if (score > 100)
  16. {
  17. result = 'I';
  18. return result;
  19. }
  20. if (score >= 90)
  21. {
  22. result = 'A';
  23. }
  24. else if (score >= 80)
  25. result = 'B';
  26. else if (score >= 70)
  27. result = 'C';
  28. else if (score >= 60)
  29. result = 'D';
  30. else if (score >= 0 && score < 60)
  31. result = 'F';
  32. else
  33. result = 'I';
  34.  
  35. return result;
  36. }
  37.  
Success #stdin #stdout 0.01s 5268KB
stdin
Standard input is empty
stdout
I