fork(1) 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. printf("please input the scores of %d students:\n",SIZE);
  10. for (i = 0; i < SIZE; i++) {
  11. scanf("%d", &score[i]);
  12. totalScore = totalScore + score[i];
  13. }
  14. printf("The average score is %f\n", totalScore / SIZE*1.0);
  15. for(i=0;i < SIZE;i++)
  16. {
  17. printf("%d ",score[i]);
  18. }
  19. for(i=0;i < SIZE;i++)
  20. {
  21. if (score[i]<60)
  22. {n++;}
  23. else {continue;}
  24. }
  25. printf("%d",n);
  26. return 0;
  27. }
Success #stdin #stdout 0.01s 5320KB
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