fork(2) download
  1. #include <stdio.h>
  2. int main(void)
  3. {
  4. int score[40];
  5. int totalScore = 0;
  6. int i;
  7. printf("Input the scores of five students:\n");
  8. for(i=0;i<40;i++)
  9. {
  10. scanf("%d",&score[i]);
  11. totalScore=totalScore+score[i];
  12. }
  13. printf("The average sore is %f\n",totalScore/40.0);
  14. return 0;
  15. }
Success #stdin #stdout 0s 548KB
stdin
23, 67, 12, 89, 45, 3, 78, 56, 91, 34, 8, 72, 19, 60, 97, 41, 5, 83, 27, 50, 14, 69, 36, 95, 22, 58, 11, 76, 44, 87, 31, 64, 9, 52, 18, 80, 39, 71, 26, 99
stdout
Input the scores of five students:
The average sore is -37480123.825000