fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. // your code goes here
  5. int score;
  6. printf("请输入分数:");
  7. scanf("%d", &score);
  8.  
  9. // 先判断分数是否合法
  10. if (score < 0 || score > 100) {
  11. printf("error!\n");
  12. } else if (score >= 85) {
  13. printf("A\n");
  14. } else if (score >= 70) {
  15. printf("B\n");
  16. } else if (score >= 60) {
  17. printf("C\n");
  18. } else {
  19. printf("D\n");
  20. }
  21. return 0;
  22. }
  23.  
  24.  
Success #stdin #stdout 0s 5320KB
stdin
86
stdout
请输入分数:A