# include <stdio.h>
#define N 10
int max(int score[])
{
int i,M;
for(i=1;i<N;i++)
if(score[1]<score[i])
{
score[1]=score[i];
}
M=score[1];
return M;
}
int min(int score[])
{
int i,m;
for(i=1;i<N;i++)
if(score[1]>score[i])
{
score[1]=score[i];
}
m=score[1];
return m;
}
int Sum(int score[])
{
int sum=0;
int i;
for(i=0;i<N;i++)
{
sum+=score[i];
}
return sum;
}
paixu(int score[])
{
int i,j,p,k;
{for(i=9;i>0;i--)
{for(j=0;j<=i;j++)
if(score[j]<score[j+1])
{
p=score[j+1];
score[j+1]=score[j];
p=score[j];
}}}
{for(k=0;k<=9;k++)
printf("%d",score[k]);}
}
int main()
{
int score[N]={67,98,75,63,82,79,81,91,66,84};
printf("最大值为%d\n",max(score));
printf("最小值为%d\n",min(score));
printf("总分为%d\n",Sum(score));
printf("平均分为%d\n",Sum(score)/N);
paixu(score);
return 0;
}
guozhchun
相关分类