想的比较简单,请问一下错在哪里?
#include <stdio.h>
int main()
{
int arr[]={67,98,75,63,82,79,81,91,66,84};
int i,j;
for(i=8;i>=0;i--)
{
for(j=0;j<=i;j++)
{
if(arr[j]<arr[j+1])
{
int temp;
temp=arr[j];
arr[j]=arr[j+1];
arr[j+1]=temp;
}
}
}
printf("降序排列结果为");
for(i=0;i<10;i++)
{
if(i!=9)
printf("%d,",arr[i]);
else
printf("%d",arr[i]);
}
int sum=0;
for(i=0;i<10;i++)
{
sum=arr[i]+sum;
}
int max;
max=arr[0];
int min;
min=arr[9];
int ave;
ave=sum/10;
printf("最高分为%d\n","最低分为%d\n","平均分为%d\n","总分为%d\n",max,min,ave,sum);
return 0;
}