fork download
  1. #include <stdio.h>
  2. #define NUM 10
  3.  
  4. int main(){
  5.  
  6. int i,j,a,n,m,maxs,mins;
  7. int score[NUM];
  8. int max_score,min;
  9.  
  10. for ( i=0 ; i < NUM ; i++ )
  11. {
  12. scanf("%d",&score[i]);
  13. printf("%d人目:%d\n",i+1,score[i]);
  14. }
  15.  
  16. a=0;
  17. max_score=score[0];
  18.  
  19. for(j=0;j<1;j++){
  20. for(i=0;i<NUM;i++)
  21. {
  22.  
  23. if(score[i]>max_score){
  24. max_score=score[i];
  25. a=i;
  26. }
  27.  
  28. }
  29.  
  30. printf("最大:%d\n",score[a]);
  31. score[a]=0;
  32. a=0;
  33. max_score=score[0];
  34. }
  35.  
  36. for(i=0;i<NUM;i++)
  37. {
  38.  
  39. if(score[i]>max_score){
  40. max_score=score[i];
  41. a=i;
  42. }
  43. }
  44. printf("2番目大きい:%d\n",score[a]);
  45.  
  46. a=0;
  47. min=100;
  48. for(j=0;j<1;j++){
  49. for(i=0;i<NUM;i++)
  50. {
  51.  
  52. if(score[i]<min){
  53. min=score[i];
  54. a=i;
  55. }
  56.  
  57. }
  58.  
  59. printf("最小:%d\n",score[a]);
  60. score[a]=100;
  61. a=0;
  62. min=100;
  63. }
  64.  
  65. for(i=0;i<NUM;i++)
  66. {
  67.  
  68. if(score[i]<min){
  69. min=score[i];
  70. a=i;
  71. }
  72. }
  73. printf("2番目小さい:%d\n",score[a]);
  74.  
  75.  
  76. }
  77.  
Success #stdin #stdout 0.01s 5320KB
stdin
50
90
30
60
100
40
80
20
10
70
stdout
1人目:50
2人目:90
3人目:30
4人目:60
5人目:100
6人目:40
7人目:80
8人目:20
9人目:10
10人目:70
最大:100
2番目大きい:90
最小:0
2番目小さい:10