#include<stdio.h>
float max,min;
void main()
{
float average(float array[],int n);
float aver,score[10];
int i;
printf("please input array:\n");
for(i=0;i<=9;i++)
scanf("%f",&score[i]);
aver=average(score,10);
printf("the average is %f\nthe max is %f\nthe min is %f\n",aver,max,min);
}
float average(float array[],int n)
{
int i;
float aver,sum=array[0];
float max=array[0],min=array[0];
for(i=1;i<=n;i++)
{
if(array[i]>max) max=array[i];
else if(array[i]<min) min=array[i];
sum=sum+array[i];
}
aver=sum/10;
return(aver);
}//这是输入10个值求最大最小及平均值的函数!错在哪里啊????