慕用4518114
2019-06-16 00:15
#include <stdio.h>
int decending(int score[])
{int i;
int j;
int sum=0;
for(i=9;i>0;i--)
{
for(j=0;j<9;j++)
{
if(score[j]>score[j+1])
{
int temp=score[j];
score[j]=score[j+1];
score[j+1]=temp;
}
}
}
printf("the decending order is\n");
for(i=0;i<10;i++)
{
printf("%d",score[i]);
sum=sum+score[i];
}
int aver=sum/10;
printf("\nthe lowest score is %d\n",score[0]);
printf("the highest score is %d\n",score[9]);
printf("the average score is %d\n",aver);
printf("the total score is %d\n", sum);
return 0;
}
int main()
{
int score[N]={67,98,75,63,82,79,81,91,66,84};
decending(score);
return 0;
}
int main()里面 int score[N]={67,98,75,63,82,79,81,91,66,84}; 这一句N没有定义,建议把N改为10,或者使用宏定义 #define N 10
i>=0
j<i
C语言入门
926212 学习 · 20797 问题
相似问题