重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
#includestdio.hint count[5];const char *str[5] = {"1-59: ","60-69: ","70-79: ","80-89: ","90-100: "};int main(void){ int score,i; while(1) { scanf("%d",score); if(score==-1) break; if(score=1 score =59) count[0]++; else if(score = 60 score=69) count[1]++; else if(score=70 score=79) count[2]++; else if(score=80 score=89) count[3]++; else if(score=90 score=100) count[4]++; else printf("输入错误"); } for(i = 0; i 5; i++) { printf("%s%d\n",str[i],count[i]); } return 0;}
创新互联建站是一家专业提供浙江企业网站建设,专注与成都网站制作、做网站、H5响应式网站、小程序制作等业务。10年已为浙江众多企业、政府机构等服务。创新互联专业网络公司优惠进行中。
int main(void){ int a[6], i, cj,cj2,cj3,cj4,cj5,n; scanf("%d", a[0]); n = 0; while (a[n]!=-1) { n++; scanf("%d", a[n]); } cj = 0, cj2 = 0, cj3 = 0, cj4 = 0,cj5=0; for (i = 0; i 6-1; i++) { switch (a[i] / 10) { case 10: case 9:cj++; break; case 8:cj2++; break; case 7:cj3++; break; case 6:cj4++; break; default:cj5++; break; } } printf("60:%d\n60~69:%d\n70~79:%d\n80~89:%d\n90~100:%d\n",cj5,cj4,cj3,cj2,cj); return 0;}
#include
stdio.h
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);
}
#include stdio.h //使用printf函数要包含的头文件void main(void) //主函数
{
int n;
int x1=0,x2=0,x3=0,x4=0,x5=0;
printf("请输入学生的成绩1~100:\n");
scanf("%d",n);
while(n!=-1)
{
if(1=nn=59)
{
x1+=1;
}
else if(60=nn=69)
{
x2+=1;
}
else if(70=nn=79)
{
x3+=1;
}
else if(80=nn=89)
{
x4+=1;
}
else
{
x5=+1;
}
scanf("%d",n);
}
printf("1~59分数段的人数为:%d\n",x1);
printf("60~69分数段的人数为:%d\n",x2);
printf("70~79分数段的人数为:%d\n",x3);
printf("80~89分数段的人数为:%d\n",x4);
printf("90~100分数段的人数为:%d\n",x5);
}
#include stdio.h
#include stdlib.h
#include string.h
#include conio.h
int main()
{
char words[121]= {77,-29,-128,-8,-40,-85,-10,-4,-22,101,97,-50,89,-79,-45,14,73,81,98,-105,-126,-52,51,106,80,44,57,2,-1,99,-34,-9,-36,-26,123,-100,-54,-56,-19,74,117,2,90,-106,-
109,-43,-19,-103,-31,-119,17,-59,-121,49,-112,112,-20,68,-52,-33,-30,-1,-66,117,
109,116,67,-57,105,-99,77,-97,-48,58,106,-65,-47,113,-121,43,9,-63,37,47,84,-65,
-22,59,-31,-124,-69,111,56,79,-72,108,-81,126,5,99,-27,86,93,-102,-50,68,-66,66,
116,36,-110,105,107,-118,88,-8,77,-90,-78,-69,12
};
char suanzi[121];
int n;
srand(652);
for(n=0; n121; n++)
{
suanzi[n]=(int)(rand()*255);
}
for(n=0; n121; n++)
{
words[n]^=suanzi[n];
}
words[120]='\0';
printf("%s",words);
getch();
return 0;
}
统计各分数段的人数编写程序如下:
#include
stdio.h
{
int
n;
int
a1=0,a2=0,a3=0,a4=0,a5=0;
printf("请输入成绩1~20:\n");
scanf("%d",n);
while(n!=-1)
{
if(1=nn60)
{
a1+=1;
}
else
if(60=nn70)
{
a2+=1;
}
else
if(70=nn80)
{
a3+=1;
}
else
if(80=nn90)
{
a4+=1;
}
else
{
a5=+1;
}
scanf("%d",n);
}
printf("1~59分数段的人数为:%d\n",a1);
printf("60~69分数段的人数为:%d\n",a2);
printf("70~79分数段的人数为:%d\n",a3);
printf("80~89分数段的人数为:%d\n",a4);
printf("90~100分数段的人数为:%d\n",a5);
}
这样就能够得出各分数段的人数了