fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. char name[100]; // get name
  5. int score; // get score
  6.  
  7. // get name
  8. printf("Input name: ");
  9. fgets(name, sizeof(name), stdin);
  10.  
  11. // get score
  12. printf("Input score: ");
  13. scanf("%d", &score);
  14.  
  15. // show name and score
  16. printf("%s your score %d grade ", name, score);
  17.  
  18. // if function score
  19. if (score >= 80) {
  20. printf("A\n");
  21. } else if (score >= 70) {
  22. printf("B\n");
  23. } else if (score >= 60) {
  24. printf("C\n");
  25. } else if (score >= 50) {
  26. printf("D\n");
  27. } else {
  28. printf("F\n");
  29. }
  30.  
  31. return 0;
  32. }
  33.  
  34.  
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
Input name: Input score:  your score 0 grade F