十位评委打分,去掉最高分和最低分,求平均分。请帮忙看看哪里错了?谢谢!
#include<stdio.h>float result(float a[10])
{int i;float min=a[0],max=a[0],sum=0,ave;
for(i=0;i<=9;i++)
{if (a[i]>max)
max=a[i];
if (a[i]<min)
min=a[i];
sum=sum+a[i];}
ave=(sum-max-min)/8;
return ave;}
void main()
{int i;float result1,a[10];
printf("Input 10 scores:\n");
for(i=0;i<=9;i++)
scanf("%d",&a[i]);
result1=result(a);
printf("ave=%f\n",result1);}