作者:yunjinqi 类别:
日期:2023-05-31 16:33:00
阅读:457 次 消耗积分:0 分
#include <stdio.h>
int main(){
double sum=0.0,avg=0.0;
double score;
double min_score=0.0,max_score=0.0;
int n;
if (scanf("%d",&n)!=EOF && n>2){
for (int i=0;i<n;i++){
if (scanf("%lf",&score)!=EOF){
sum+=score;
if (i==0){max_score=score;min_score=score;}
if (i>0){
if (score>max_score){max_score=score;}
if (score<min_score){min_score=score;}
}
}
}
avg = (sum-max_score-min_score)/(n-2);
printf("%.2f",avg);
}
else{
printf("input wrong");
}
return 0;
}