fork download
  1. #include <stdio.h>
  2.  
  3. #define NUM 10
  4.  
  5. int main(void) {
  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. for(i = 0; i < NUM; i++) {
  23. if(score[i] > max_score) {
  24. max_score = score[i];
  25. }
  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] =
  35. 50.0 * (score[i] - min_score)
  36. / (max_score - min_score)
  37. + 50;
  38. }
  39.  
  40. // 表示
  41. printf("\n結果\n");
  42.  
  43. for(i = 0; i < NUM; i++) {
  44. printf("%d人目の点数:%d\n",i+1,score[i]);
  45. }
  46. printf("\n");
  47. printf("最高点:%d 最低点:%d\n",max_score,min_score);
  48. printf("\n");
  49. for(i = 0;i < NUM;i ++){
  50. printf("%d人目:%d → %f\n",i+1,score[i],new_score[i]);
  51. }
  52. return 0;
  53. }
Success #stdin #stdout 0s 5288KB
stdin
11
22
33
44
55
66
77
88
99
58
stdout
1人目の点数:2人目の点数:3人目の点数:4人目の点数:5人目の点数:6人目の点数:7人目の点数:8人目の点数:9人目の点数:10人目の点数:
結果
1人目の点数:11
2人目の点数:22
3人目の点数:33
4人目の点数:44
5人目の点数:55
6人目の点数:66
7人目の点数:77
8人目の点数:88
9人目の点数:99
10人目の点数:58

最高点:99 最低点:11

1人目:11 → 50.000000
2人目:22 → 56.250000
3人目:33 → 62.500000
4人目:44 → 68.750000
5人目:55 → 75.000000
6人目:66 → 81.250000
7人目:77 → 87.500000
8人目:88 → 93.750000
9人目:99 → 100.000000
10人目:58 → 76.704544