2 回答
TA贡献34条经验 获得超15个赞
#include<stdio.h>
#define N 30
int main()
{
int shuzu[N],i;
int pass=0,defail=0,sum=0,ave;
printf("请输入%d个人的成绩:\n",N);
for(i=0;i<N;i++)
{
scanf("%d",&shuzu[i]);
sum+=shuzu[i];
if(shuzu[i]>=60) pass++;
else if(shuzu[i]<60) defail++;
}
ave=sum/N;
printf("平均成绩为:%d\n",ave);
printf("及格人数为:%d\n",pass);
printf("不及格人数为:%d\n",defail);
return 0;
}
TA贡献34条经验 获得超15个赞
#include<stdio.h>
#define N 3
int main()
{
int shuzu[N],i;
int pass=0,defail=0,sum=0,ave;
for(i=0;i<N;i++)
{
scanf("%d",&shuzu[i]);
sum+=shuzu[i];
if(shuzu[i]>=60) pass++;
else if(shuzu[i]<60) defail++;
}
ave=sum/N;
printf("平均成绩为:%d\n",ave);
printf("及格人数为:%d\n",pass);
printf("不及格人数为:%d\n",defail);
return 0;
}
- 2 回答
- 0 关注
- 1872 浏览
添加回答
举报