#include<stdio.h>
#include<stdlib.h>
//本程序用于统计优秀(A),及格(B),不及格(C)人数
int main()
{
int A = 0, B = 0, C = 0;
int n;//n是参与本次测试的学生人数
int high = 0,low = 0;//划分线分数
printf("输入学生人数:\n");
scanf_s("%d",&n);
printf("多少分及以上为及格?\n");
scanf_s("%d", &low);
printf("多少分及以上为优秀?\n");
scanf_s("%d",&high);
if (high > low)
{
for (int i = 1; i <= n; i++)
{
int score = 0;
printf("请输入分数");
scanf_s("%d", &score);
if (score >= 0)
{
if (score >= high) A++;
else if (score >= low) B++;
else C++;
}
else
{
printf("分数不应该小于0");
exit(0);
}
}
printf("优秀有%d\n", A);
printf("及格有 %d\n", B);
printf("不及格有%d\n", C);
getchar();
}
else
printf("优秀分不应该小于及格分");
return 0;
}