/编写程序,输入一批学生的成绩,遇0或负数则输入结束,要求统计并输出优秀(大于85)、
通过(60~84)和不及格(小于60)的学生人数。/
#include <stdio.h>
void fun(int *score,int n)
{
int outstanding=0;
int pass=0;
int flunk=0;
for(int i=0;i<n;i++)
{
if(score[i]<=0)
{
printf("finish\n");
break;
}
else if(score[i]>85)
{
outstanding++;
}
else if(score[i]>=60 &&score[i]<=84)
{
pass++;
}
else if(score[i]<60)
{
flunk++;
}
}
printf("outstanding:%d pass:%d flunk:%d\n",outstanding,pass,flunk);
}
int main(void)
{
int n;
int score[100];
printf("please enter student number\n");
scanf("%d",&n);
for(int i=0;i<n;i++)
{
printf("please %d student score\n",i+1);
scanf("%d",&score[i]);
}
fun(score,n);
return 0;
}
标签:int,60,score,输入,84,85
From: https://www.cnblogs.com/yesiming/p/18297393