#include <
stdio.h>
int main()
{
printf("请输入学生的成绩:\n");
int maxScore = 0;
int minScore = 0;
double avgScore = 0;
int jigeCount = 0;
int buJigeCount = 0;
int totalScore = 0;
int nScore;
for(int i = 0; i < 20; i++)
{
scanf("%d", &nScore);
if (i == 0)
{
maxScore = nScore;
minScore = nScore;
}
if (maxScore < nScore)
{
maxScore = nScore;
}
if (minScore > nScore)
{
minScore = nScore;
}
if (nScore >= 60)
{
jigeCount++;
}
else
{
buJigeCount++;
}
totalScore += nScore;
}
avgScore = (double)totalScore/20.0;
printf("最高分:%d, 最低分: %d, 平均分:%0.2f\n", maxScore, minScore, avgScore);
printf("及格人数:%d 不及格人数:%d\n", jigeCount, buJigeCount);
return 0;
}
运行结果: