fork download
  1. #include <stdio.h>
  2. #define SUB 5
  3.  
  4. int main(void)
  5. {
  6. int test[SUB];
  7. int jo11;
  8. int i, j, jt, jr;
  9. int ebisu = 0;
  10.  
  11. printf("テストの点数を入力してください。\n");
  12. for(i=0; i<SUB; i++){
  13. scanf("%d",&test[i]);
  14. }
  15. for(jt=0; jt<SUB-1; jt++){
  16. for(jr=jt+1; jr<SUB; jr++){
  17. if(test[jr] > test[jt]){
  18. jo11 = test[jr];
  19. test[jr] = test[jt];
  20. test[jt] = jo11;
  21. }
  22. }
  23. }
  24.  
  25.  
  26. for(j=0; j<SUB; j++){
  27. printf("%d番目の人の点数は%dです。\n", j+1, test[j]);
  28. if(test[j]>=70){
  29. ebisu += 1;
  30. }
  31. }
  32. printf("70点以上の学生は%d人です。\n", ebisu);
  33.  
  34. return 0;
  35. }
Success #stdin #stdout 0s 5316KB
stdin
1
2
3
4
77
stdout
テストの点数を入力してください。
1番目の人の点数は77です。
2番目の人の点数は4です。
3番目の人の点数は3です。
4番目の人の点数は2です。
5番目の人の点数は1です。
70点以上の学生は1人です。