fork download
  1. #include <stdio.h>
  2. #define NUM 10
  3. int main(void) {
  4. int data[10], count, i, j, first, second, third ,x;
  5.  
  6. for(x=0;x<10;x++){
  7. scanf("%d",&data[x]);
  8. }
  9.  
  10. for(i=0;i<NUM;i++){
  11. first = data[i];
  12. count = 0;
  13. for(j=0;j<NUM;j++){
  14. if(first < data[j]) count++;
  15. }
  16. if(count==0) break;
  17. }
  18. printf("1人目は%d点\n", first);
  19. for(i=0;i<NUM;i++){
  20. second = data[i];
  21. count = 0;
  22. for(j=0;j<NUM;j++){
  23. if(second < data[j]) count++;
  24. }
  25. if(count==1) break;
  26. }
  27.  
  28.  
  29. printf("2人目は%d点\n",second);
  30.  
  31. for(i=0;i<NUM;i++){
  32. third = data[i];
  33. count = 0;
  34. for(j=0;j<NUM;j++){
  35. if(third < data[j]) count++;
  36. }
  37. if(count==2) break;
  38. }
  39.  
  40.  
  41. printf("3人目は%d点\n",third);
  42.  
  43.  
  44. return 0;
  45. }
  46.  
Success #stdin #stdout 0s 5312KB
stdin
1 2 3 4 5 6 7 8 9 0
stdout
1人目は9点
2人目は8点
3人目は7点