#include
void main()
{
int i, n, reno; float score[30], avr, a, b, c;
char name[30][9];
for(i = 0; i < 30; i++)
{
printf("%d号的成绩:", i+1); scanf("%f", &score[i]);
if(score[i] < 0) break;
printf("%d号的姓名:", i+1); scanf("%s", name[i]);
}
n = i;
printf("统计不及格人数:\n");
reno = 0; avr = 0;
for(i = 0; i < n; i++)
{
if( score[i] < 60) { reno++; printf("%d, %s\n", i+1, name[i]); }
avr += score[i];
}
printf("不及格人数为%d\n\n", reno);
printf("统计成绩在平均分及平均分之上的学生人数:\n");
avr /= n;reno = 0;
for(i = 0; i < n; i++)
{
if(score[i] >= avr) { reno++; printf("%d, %s\n", i+1, name[i]); }
}
printf("成绩在平均分及平均分之上的学生人数为%d\n\n", reno);
printf("统计各分数段的人数及所占百分比(分数段为<60,60~79,>=80):\n");
a = b = c =0;
for(i = 0; i < n; i++)
{
if(score[i] < 60) a++;
else if(score[i] >= 80) c++;
else b++;
}
printf("<60:\t%.1f%%\n60~79:\t%.1f%%\n>=80:\t%.1f%%\n",100*a/n,100*b/n,100*c/n);
}