fork(2) download
  1. #include<stdio.h>
  2. int main(void)
  3. { int score[5];
  4. int totalscore = 0;
  5. int i;
  6. printf("please input the scores of five students:\n");
  7. for(i=0;i<5;i++)
  8. {scanf("%d",&score[i]);
  9. totalscore=totalscore+score[i];}
  10.  
  11. printf("The average score is %f\n", totalscore / 5.0);
  12. return 0;
  13. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
please input the scores of five students:
The average score is 304996495.200000