Write a program to input the scores of a group of students from the keyboard, calculate the average score, and count the number of failed students.
#include<stdio.h>
int main()
{
int sum,average,a,b,c,i;
printf("输入完成时请输入一个随机的负数\n");
printf("请输入学生成绩:");
sum=0;
average=0;
a=0;//chengji
b=0;//jigerenshu
c=0;//bujigerenshu
do{
scanf("%d",&a);
if(a>=0)
{
b++;
sum=sum+a;
if(a<60)
c++;
}
}
while(a>=0);
average=sum/b;
printf("不及格人数为:%d\n",c);
printf("平均分:%d",average);
}