请问下大佬们,这个排列是哪里不对,为啥出来的结果还是乱序
#include <stdio.h>
int main()
{
int score[10]={67,98,75,63,82,79,81,91,66,84};
int sum=0,i,max,min,tamp;
float ave;
for(i=0;i<10;i++)
{
sum=sum+score[i];
}
for (i=0;i<10;i++)
{
if(score[i]<score[i+1])
{
tamp=score[i+1];
score[i+1]=score[i];
score[i]=tamp;
}
}
ave = (float)sum/10;
max=score[0];
min=score[9];
printf("总分为:%d\n",sum);
printf("最高分为:%d\n",max);
printf("最低分为:%d\n",min);
printf("平均分为:%f\n",ave);
for (i=0;i<10;i++)
{
printf("score[%d]:%d\n",i,score[i]);
}
return 0;
}