#include<stdio.h>
int main(){
int a[100],n,i,max=a[0],min=a[0];
float sum,ave;
scanf("%d",&n);
for(i=0;i<n;i++){
scanf("%d",a[i]);
sum+=a[i];
}
for(i=1;i<n;i++){
if(min>a[i])min=a[i];
if(max<a[i])max=a[i];
}
ave=(sum-min-max)*1.0/(n-2);
printf("%.2f\n",ave);
return 0;
}
原文地址:https://www.cnblogs.com/huoyuying/p/9735694.html
时间: 2024-10-11 04:53:40