fork download
  1. #include <stdio.h>
  2. #define NUM 10
  3.  
  4. int main(void) {
  5. int i,j,max,a;
  6. int score[NUM];
  7. for(i=0;i<NUM;i++){
  8. scanf("%d",&score[i]);
  9. if(0<=score[i]&&score[i]<=100){
  10. printf("%d人目の点数:%d\n",i+1,score[i]);
  11. }else{
  12. printf("正しい点数を入力してください");
  13. }
  14.  
  15. }
  16.  
  17. max=score[0];
  18. a=0;
  19. for(j=2;j<2;j++){
  20.  
  21. for(i=0;i<NUM;i++){
  22. if(score[i]>max){
  23. max=score[i];
  24. a=i;
  25. }
  26. }
  27.  
  28.  
  29. printf("2番目に大きい点数:%d\n",score[a]);
  30. score[a]=0;
  31. max=score[0];
  32. a=0;
  33. }
  34.  
  35.  
  36. }
  37.  
Success #stdin #stdout 0s 5336KB
stdin
32
52
80
98
76
56
87
43
90
66
stdout
1人目の点数:32
2人目の点数:52
3人目の点数:80
4人目の点数:98
5人目の点数:76
6人目の点数:56
7人目の点数:87
8人目の点数:43
9人目の点数:90
10人目の点数:66