fork download
  1. #include<stdio.h>
  2. #define SIZE 6
  3. int main(void)
  4. {
  5. int score[SIZE];
  6. int totalScore = 0;
  7. int i;
  8. int n=0;
  9. int max,min;
  10. printf("please input the scores of %d students:\n",SIZE);
  11. for (i = 0; i < SIZE; i++) {
  12. scanf("%d", &score[i]);
  13. totalScore = totalScore + score[i];
  14. }
  15. printf("The average score is %f\n", totalScore / SIZE*1.0);
  16. for(i=0;i < SIZE;i++)
  17. {
  18. printf("%d ",score[i]);
  19. }
  20. for(i=0;i < SIZE;i++)
  21. {
  22. if (score[i]<60)
  23. {n++;}
  24. else {continue;}
  25. }
  26. printf("不及格人数为:%d\n",n);
  27. max=score[0];
  28. for(i=1;i < SIZE;i++)
  29. { if (max>score[i]){continue;}
  30. else max=score[i];}
  31.  
  32. printf("最大数为%d",max);
  33. return 0;
  34. }
Success #stdin #stdout 0.01s 5292KB
stdin
55
66
77
88
44
33
stdout
please input the scores of 6 students:
The average score is 60.000000
55 66 77 88 44 33 不及格人数为:3
最大数为88