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. printf("please input the scores of %d students:\n",SIZE);
  9. for (i = 0; i < SIZE; i++) {
  10. scanf("%d", &score[i]);
  11. totalScore = totalScore + score[i];
  12. }
  13. printf("The average score is %f\n", totalScore / SIZE*1.0);
  14. for(i=0;i < SIZE;i++)
  15. {
  16. printf("%d ",score[i]);
  17. }
  18. return 0;
  19. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
please input the scores of 6 students:
The average score is 352334845.000000
0 0 -1010253179 21981 -1170732256 5232