#include<>
double fun(double a[],int n)
{
double sum=0.0,max=a[0],min=a[0];
int i;
for(i=0;i<n;i++)
{
if(max<a[i])
max=a[i];
if(min>a[i])
min=a[i];
sum=sum+a[i];
}
sum=sum-min-max;
return sum/(n-2);
}
void main()
{
double aver,a[100];
int i,n;
printf("please input the count:");
scanf("%d",&n);
printf("please input the nums:");
for(i=0;i<n;i++)
scanf("%lf",&a[i]);
aver=fun(a,n);
printf("the aver is:%lf\n",aver);
}
转载于:/-slz-2/p/