求大佬帮忙看看是哪里错了。。后两个函数的结果有问题
#include <stdio.h>
int sum;
int getsum(int score[])
{ int i;
for(i=0;i<=9;i++)
{
sum += score[i];
}
printf("考试的总分为%d\n",sum);
}
void getmax(int score[])
{ int i;
for(i=0;i<9;i++)
{
if(score[i]>score[i+1])
{ int temp;
temp=score[i];
score[i]=score[i+1];
score[i+1]=temp;
}
}
int max=score[9];
printf("最高分为%d\n",max);
}
void getmin(int score[])
{ int i;
for(i=0;i<9;i++)
{
if(score[i]<score[i+1])
{ int temp;
temp=score[i];
score[i]=score[i+1];
score[i+1]=temp;
}
}
int min=score[9];
printf("最低分为%d\n",min);
}
int getaverage(n)
{
printf("平均分为%d",n/10.0);
return 0;
}
void rank(int score[])
{ int i,j;
for(i=8;i>=0;i--)
{
for(j=0;j<=i;j++)
if(score[j]<score[j+1])
{ int temp;
temp=score[j];
score[j]=score[j+1];
score[j+1]=temp;
}
}
for(i=0;i<=9;i++);
{
printf("%d",score[i]);
}
}
int main()
{
int score[10]={67,98,75,63,82,79,81,91,66,84};
getsum(score);
getmax(score);
getmin(score);
getaverage(sum);
rank(score);
return 0;
}