#include <stdio.h>
int SumAverage()
{
int score[10] = { 67, 98, 75, 63, 82, 79, 91, 66, 84 };
int i;
int sum = 0;
int average;
for (i = 0; i < 10; i++)
{
sum = sum + score[i];
average = sum / 10;
}
printf("考试的总分是:%d", sum);
printf("考试平均分是:%d", average);
return 0;
}int paixuchengji()
{
int score[10] = { 67, 98, 75, 63, 82, 91, 66, 84 };
int i;
int j;
int temp;
for (i = 8; i >= 0; i--)
{
for (j = 0; j <=i; j++)
{
if (score[j] < score[j + 1])
{
temp = score[j];
score[j] = score[j + 1];
score[j + 1] = temp;
}
}
}
printf("\n成绩降序排序为:\n");
for (i = 0; i < 10; i++)
{
if (i != 9)
printf("%d\n", score[i]);
else
printf("%d\n", score[i]);
}
printf("考试成绩的最高分是:%d", score[0]);
printf("考试的最低成绩是:%d\n", score[9]);
}
int main()
{
SumAverage();
paixuchengji();
return 0;
}
考试的总分是:705考试平均分是:70
成绩降序排序为:
98
91
84
82
75
67
66
63
0
0
考试成绩的最高分是:98考试的最低成绩是:0
请按任意键继续. . .
这是运行后的结果
RockenRoll
慕移动9341187