1个回答
展开全部
代码文本:
#include "stdio.h"
#define N 10
void myf(double *a,double *b,int n){
int i;
for(b[1]=b[2]=a[0],b[0]=i=0;i<n;b[0]+=a[i++])
if(b[1]<a[i])
b[1]=a[i];
else if(b[2]>a[i])
b[2]=a[i];
b[0]/=n;
}
int main(int argc,char *argv[]){
double a[N],b[3];
int i;
printf("Please enter %d data...\n",N);
for(i=0;i<N;scanf("%lf",a+i++));
myf(a,b,N);
printf("The MAX are %f\nThe MIN are %f\nThe AVE are %f\n",b[1],b[2],b[0]);
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询