fork download
  1. #include <stdio.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. for(i = 0; i < NUM; i++)
  13. {
  14. printf("%d人目の点数:", i + 1);
  15. scanf("%d", &score[i]);
  16. }
  17.  
  18. max_score = score[0];
  19. min_score = score[0];
  20.  
  21. for(i = 1; i < NUM; i++)
  22. {
  23. if(score[i] > max_score)
  24. {
  25. max_score = score[i];
  26. }
  27.  
  28. if(score[i] < min_score)
  29. {
  30. min_score = score[i];
  31. }
  32. }
  33.  
  34. printf("\n");
  35. printf("最高点:%d 最低点:%d\n\n",
  36. max_score,
  37. min_score);
  38.  
  39. for(i = 0; i < NUM; i++)
  40. {
  41. new_score[i] =
  42. 50.0 * (score[i] - min_score)
  43. / (max_score - min_score)
  44. + 50;
  45.  
  46. printf("%d人目:%d → %f\n",
  47. i + 1,
  48. score[i],
  49. new_score[i]);
  50. }
  51.  
  52. return 0;
  53. }
Success #stdin #stdout 0s 5288KB
stdin
Standard input is empty
stdout
1人目の点数:2人目の点数:3人目の点数:4人目の点数:5人目の点数:6人目の点数:7人目の点数:8人目の点数:9人目の点数:10人目の点数:
最高点:860281632 最低点:-2103962907

1人目:1 → -29.053391
2人目:0 → -29.053391
3人目:858905429 → 100.051712
4人目:5362 → -29.053591
5人目:0 → -29.053391
6人目:0 → -29.053391
7人目:-2103962907 → 50.000000
8人目:21867 → -29.054213
9人目:860281632 → 100.000000
10人目:5362 → -29.053591