fork download
  1. #include <stdio.h>
  2. #define NUM 10
  3.  
  4. int main()
  5. {
  6. int i;
  7. int score[NUM];
  8. float new_score[NUM];
  9. int max_score, min_score;
  10.  
  11. for ( i=0 ; i < NUM ; i++ )
  12. {
  13. scanf("%d",&score[i]);
  14. if(score[i]>=0 && score[i]<=100){
  15. printf("%d人目の点数:%d\n",i+1,score[i]);
  16. }else{
  17. printf("%d人目の点数:正しい点数を入力してください\n",i+1);
  18. }
  19. }
  20.  
  21. max_score=score[0];
  22. for(i=0;i<5;i++)
  23. {
  24. if(score[i]>max_score){
  25. max_score=score[i];
  26. }
  27. }
  28. printf("\n最高点:%d ",max_score);
  29.  
  30. min_score=score[0];
  31. for(i=0;i<5;i++)
  32. {
  33. if(score[i]<min_score){
  34. min_score=score[i];
  35. }
  36. }
  37. printf("最低点:%d\n\n",min_score);
  38.  
  39. // 新しい点数
  40.  
  41. for ( i=1 ; i <= NUM ; i++ )
  42. {
  43. new_score[i]==((50.00*(score[i]-min_score))/(max_score-min_score))+50.00;
  44. printf("%d人目の点数:%d → %d\n",i+1,score[i],new_score[i]);
  45. }
  46. }
  47.  
  48.  
Success #stdin #stdout 0.01s 5324KB
stdin
25
39
42
76
35
48
81
41
74
55


stdout
1人目の点数:25
2人目の点数:39
3人目の点数:42
4人目の点数:76
5人目の点数:35
6人目の点数:48
7人目の点数:81
8人目の点数:41
9人目の点数:74
10人目の点数:55

最高点:76   最低点:25

2人目の点数:39 → 0
3人目の点数:42 → 0
4人目の点数:76 → 0
5人目の点数:35 → 0
6人目の点数:48 → 0
7人目の点数:81 → 0
8人目の点数:41 → 0
9人目の点数:74 → 0
10人目の点数:55 → 0
11人目の点数:-561284858 → 0