简单题,求max,min,average,程序已给,求指正
#include<stdio.h>int main()
{
float text(float n,float score[]);
float n,score[100];
float i,m,mi,av,j;
for(i=1;i<=n;i++)
{
for(j=0;j<=n;j++)
while(scanf("%f",&score[j])!=EOF)
{
m=max(score);
mi=min(score);
av=average(score);
printf("max=%.1f min=%.1f average=%.1\n",m,mi,av);
}
}
return 0;
}
float text(float n,float score[])
{
float i,max,min,average,j,sum=score[0];
max=score[0];
for(j=0;j<=n;j++)
if(score[j]>max)
max=score[j];
return max;
min=score[n];
for(j=n;j>=0;j++)
if(score[j]<min)
min=score[j];
return min;
for(j=0;j<=n;j++)
sum=sum+score[j];
average=sum/n;
return average;
}