#include
void main()
{
int max=0,sum=0,min=0;
int arr[10];
for(int i=0;i<10;i++)
{
printf("请输入第%d个元素\n",i+1);
scanf("%d",&arr[i]);
}
max = arr[0];
min = arr[0];
for(int i=0;i<10;i++)
{
if(maxif(min>arr[i])min = arr[i];
sum+=arr[i];
}
printf("最大值是%d",max);
printf("最小值是%d",min);
printf("平均值是%d",sum/10);
}
#include
float max=0,min=0;
int main()
{float average(float array[],int n);
float ave,score[10];
int i;
printf("please enter 10 scores:");
for(i=0;i<10;i++)
scanf("%f",&score[i]);
ave=average(score,10);
printf("max=%6.2f\nmin=%6.2f\naverage=%6.2f\n",max,min,ave);
return 0;
}
float average(float array[],int n)
{
int i;
float aver,sum=array[0];
max=min=array[0];
for(i=1;i
max=array[i];
else if(array[i]>min)
min=array[i];
sum=sum+array[i];
}
aver=sum/n;
return 0;
}