fork download
  1. #include <stdio.h>
  2.  
  3. int main(void) {
  4. int n,sum=0,score,i,min=100,max=0;
  5. double average;
  6. scanf("%d",&n);
  7. for(i=1;i<=n;i++){
  8. scanf("%d",&score);
  9. sum=sum+score;
  10. if(score>max)
  11. max=score;
  12. if(score<min)
  13. min=score;
  14. }
  15. sum=sum-max-min;
  16. average=sum*1.0/(n-2);
  17. printf("%.3lf",average);
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0.01s 5268KB
stdin
10
90 89 92 90 93 95 88 90 89 88
stdout
90.125