fork download
  1. #include <stdio.h> // <<tdio.h> を修正
  2.  
  3. #define NUM 10
  4.  
  5. int main()
  6. {
  7. int i;
  8. int score[NUM];
  9. float new_score[NUM];
  10. int max_score, min_score;
  11.  
  12. // 点数の入力
  13. for (i = 0; i < NUM; i++) {
  14. printf("%d人目の点数:", i + 1);
  15. scanf("%d", &score[i]);
  16. }
  17.  
  18. // 最高点・最低点の初期化
  19. max_score = score[0];
  20. min_score = score[0];
  21.  
  22. // 最高点・最低点を探す
  23. for (i = 1; i < NUM; i++) {
  24. if (score[i] > max_score) {
  25. max_score = score[i];
  26. }
  27. if (score[i] < min_score) {
  28. min_score = score[i];
  29. }
  30. }
  31.  
  32. // 補正点数の計算
  33. for (i = 0; i < NUM; i++) {
  34. new_score[i] = 50.0 * (score[i] - min_score) / (max_score - min_score) + 50.0;
  35. }
  36.  
  37. // 最高点・最低点の表示
  38. printf("\n最高点:%d 最低点:%d\n\n", max_score, min_score);
  39.  
  40. // 補正後の点数を表示
  41. for (i = 0; i < NUM; i++) {
  42. printf("%d人目:%d → %f\n", i + 1, score[i], new_score[i]);
  43. }
  44.  
  45. return 0;
  46. }
  47.  
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
1人目の点数:2人目の点数:3人目の点数:4人目の点数:5人目の点数:6人目の点数:7人目の点数:8人目の点数:9人目の点数:10人目の点数:
最高点:15774463 最低点:0

1人目:0 → 50.000000
2人目:0 → 50.000000
3人目:0 → 50.000000
4人目:0 → 50.000000
5人目:0 → 50.000000
6人目:0 → 50.000000
7人目:15774463 → 100.000000
8人目:0 → 50.000000
9人目:194 → 50.000614
10人目:0 → 50.000000