#include <stdio.h>
int sum(int score[])
{
int sum=0;
int i;
for(i=0;i<=9;i++)
{
sum+=score[i];
}
return sum;
}
int max(int score[])
{
int value;
int i;
int j;
for(i=0;i<9;i++)
{
for(j=0;j<i;j++)
{
if(score[j]<score[j+1])
{
value=score[j];
score[j]=score[j+1];
score[j+1]=value;
}
}
}
return score[0];
}
int min(int score[])
{
int value=0;
int i;
int j;
for(i=0;i<9;i++)
{
for(j=0;j<i;j++)
{
if(score[j]<score[j+1])
{
value=score[j];
score[j]=score[j+1];
score[j+1]=value;
}
}
}
return score[9];
}
int average(int score[])
{
int sum=0;
int i;
for(i=0;i<=9;i++)
{
sum+=score[i];
}
return sum/10;
}
int order(int score[])
{
int value;
int i;
int j;
for(i=0;i<9;i++)
{
for(j=0;j<i;j++)
{
if(score[j]<score[j+1])
{
value=score[j];
score[j]=score[j+1];
score[j+1]=value;
}
}
printf("%d" ,score[i]);
printf(" ");
}
return 0;
}
int main()
{
int score[10]={67,98,75,63,82,79,81,91,66,84};
sum(score);
max(score);
min(score);
average(score);
order(score);
printf("%d\n %d\n %d\n %d\n",sum(score),max(score),min(score),average(score));
return 0;
}
j<i