编程题1,帮忙做下,谢谢!急!

来源:百度知道 编辑:UC知道 时间:2024/06/01 12:20:42
/* 求6个成绩的平均值及最大值 */
#include <stdio.h>
float fun ( float *a , int n ,float *max)
{

}
main()
{
float score[30]={ 80, 80.5, 81, 81.5, 82,82.5}, aver,max;
aver = fun( score,6,&max );
printf( "\nAverage score is: %5.2f\n", aver);
printf( "\nthe max score is: %5.2f\n", max);
}


#include <stdio.h>
float fun ( float *a , int n ,float *max)
{
int i;
float sum=0,aver;
*max=a[0];
for(i=0;i<6;i++)
{
if (a[i>]>max)
*max=a[i];
sum=sum+a[i];
}
*aver=sum/6;
return *aver;
}
main()
{
float score[30]={ 80, 80.5, 81, 81.5, 82,82.5}, aver,max;
aver = fun( score,6,&max);
printf( "\nAverage score is: %5.2f\n", aver);
printf( "\nthe max score is: %5.2f\n", max);
}

#include <stdio.h>
float fun ( float *a , int n ,float *max)
{
int i;
float sum=0,aver;
*max=a[0];
for(i=0;i<6;i++)
{
if (a[i>]>max)
*max=a[i];
sum=sum+a[i];
}
*aver=sum/6;
return *aver;
}
main()
{
float score[30]={ 80, 80.5, 81, 81.5, 82,82.5}, aver,max;
aver = fun( s