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. if(score<0||score>100){
  9. printf("error");
  10. return 0;
  11. }
  12. switch(score/10)
  13. { case 10:
  14. case 9:
  15. case 8:
  16. if(score>=85)
  17. printf("A");
  18. else printf("B");break;
  19. case 7: printf("B");break;
  20. case 6: printf("C");break;
  21. default:printf("D"); }
  22. return 0;
  23. }
  24.  
Success #stdin #stdout 0s 5308KB
stdin
76
stdout
请输入成绩:B