#include <stdio.h>
int sort(int i[]);
int main()
{
int score[10]={67,98,75,63,82,79,81,91,66,84};
sort(score);
int max,min,sum;float aver;
max=score[0];min=score[9];
int i,k;
for(i=0;i<=9;i++)
sum+=score[i];
aver=sum/10;
printf("max=%d\nmin=%d\naver=%.1f\nsum=%d\n",max,min,aver,sum);
for(k=0;k<=9;k++)
printf("score[%d]=%-3d",k,score[k]);
return 0;
}
int sort(int *score)
{
int i,j,temp,k;
for(i=0;i<=10;i++)
{
for(j=0;j<=10;j++)
{
if(score[i]<=score[j]){
temp=score[i];
score[i]=score[j];
score[j]=temp;
}
}
}
return score;
}
mooc网有时候会出错,不过没关系的。