以下是引用liang30890136在2004-10-12 11:25:51的发言:
#include<stdio.h>
main()
{
float average(float array[10]);
float a;
int i;
float c[10];
for(i=0,i<=9,i++)
{
scanf("%f",&c[i]);
}
a=average (c);
printf("%f\n",a) ;
}
float average(float array[10])
{
float aver,sum;
int i;
sum=0;
for(i=0;i<=9;i++)
{sum=sum+array[i];}
aver=sum/10;
return (aver);
}


这样改一下试试:
#include<stdio.h>
main()
{
float average(float array[]);
float a;
int i;
float c[10];
for(i=0,i<=9,i++)
{
scanf("%f",&c[i]);
}
a=average (c);
printf("%f\n",a) ;
}
float average(float array[])
{
float aver,sum;
int i;
sum=0;
for(i=0;i<=9;i++)
{sum=sum+array[i];}
aver=sum/10;
return (aver);
}