2012年安徽计算机等级考试机试试题

上传人:j****9 文档编号:45982794 上传时间:2018-06-20 格式:DOC 页数:15 大小:51.50KB
返回 下载 相关 举报
2012年安徽计算机等级考试机试试题_第1页
第1页 / 共15页
2012年安徽计算机等级考试机试试题_第2页
第2页 / 共15页
2012年安徽计算机等级考试机试试题_第3页
第3页 / 共15页
2012年安徽计算机等级考试机试试题_第4页
第4页 / 共15页
2012年安徽计算机等级考试机试试题_第5页
第5页 / 共15页
点击查看更多>>
资源描述

《2012年安徽计算机等级考试机试试题》由会员分享,可在线阅读,更多相关《2012年安徽计算机等级考试机试试题(15页珍藏版)》请在金锄头文库上搜索。

1、第一套 一:输出个位数字为 7 的最小的 10 个素数 如 7.17.3747.#include void main() int i,j,flag,n;n=0;i=7;while(n=0) (flag=0) /*$ERROR3$*/ n=n+1;printf(“%dn“,i);i=i+10; 二:从键盘上输入学生成绩,速出其相对的等 级(90-100)为 A,80-89 为 B,70-79 为 C60-69 为 D,小于 60 为 E #include void main() int score;printf(“Enter your score:“);scanf(“%d“,_); switch

2、(_) scorer/10 /*$BLANK2$*/case 10:case 9:printf(“An“);break;case 8:printf(“Bn“);break;case 7:printf(“Cn“);break;case 6:printf(“Dn“);break;_:printf(“En“); default /*$BLANK3$*/ 第二套 一:从键盘上输入学生成绩,速出其相对的等 级(90-100)为 A,80-89 为 B,70-79 为 C60-69 为 D,小于 60 为 E#include void main() int a;scanf(“%d“,a); (“%d“,

3、elseelse if (a=90) printf(“An“); if (a=90) printf(“An)“; /*$ERROR2$*/else if(a=80) printf(“Bn“);else if(a=70) printf(“Cn“);else if(a=60) printf(“Dn“);printf(“En“); else printf(“En“); /*$ERROR3$*/ 二:将正整数 s 中的各位上数字依次输出,按 相反的次序构成一个新的数放在 t 中 例如: s=1234,则 t=4321 #include void main() long s, t; printf(“nP

4、lease enter s:“); scanf(“%ld“, t = s%10; s/= 10;while(_) s0 /*$BLANK1$*/ t =_+ s%10; t*10 /*$BLANK2$*/ s/= 10; printf(“The result is: _n“, t); %1d /*$BLANK3$*/ 第三套 一:输入 n,如输入 3 则有1 22 3 3 3 #include void main() int i,j; int n;scanf(“%d“,n); - i void main() int i,a,b,c,n;n=_; -0 /*$BLANK1$*/for(i=101

5、;i void main() int a10=-3,1,-5,4,9,0,-8,7,-6,2;int i,addr;addr=1; -=0 /*$ERROR1$*/i=1;while(i #include void main() char s100; int left,right,middle,lenth; printf(“Please input a string:“); gets(s); lenth = strlen(s); left = _; -0 /*$BLANK1$*/ middle = lenth/2;while(left void main() char s81; int num

6、5,i,k,j; printf(“Please enter a string:“); gets(s); i=5; for (k=0;k=0) numi+; j-;-j+ /*$ERROR3$*/ for (i=0;i void main() int i,j,row,col;int a34=3,5,1,8,6,4,11,7,9,3,10,2;row=col=0; for(i=0;i struct student int num;char name12;int score; ; void main() 最前面加上struct student stud6= 1001,“Pan Dong“,48, /

7、*$ERROR1$*/1002,“Zhao Hua“,62,1003,“Hu Litai“,93,1004,“Zhang Li“,85,1005,“Liu Ming“,58,1006,“Xin Peng“,37;int i,n=0;printf(“numtnamettscoren“);i=1; -1 改为 0 /*$ERROR2$*/while(i void main() int i;float a9,max,min,ave;printf(“Input array:n“);for(i=0;iai)_; -min=a【i】 /*$BLANK3$*/ave=(ave-max-min)/7;prin

8、tf(“Mark=%.3fn“,ave); 第七套一:将 s 中所有小写字母改写为该字母的下一个字 母,但是如果是字母 z 则改成 a 大写字母和其他字 符保持不变 #include void main() char s80;int i;getc(s); -gets /*$ERROR1$*/ for(i=0; si!=0; i+)if(si=z) - = = /*$ERROR2$*/si=a; else if(si=a printf(“Please input x:“); scanf(“%lf“,_); - elsey=8+(x-3)*1.5;printf(“y=%.1fn“,y); 第八套

9、一:计算 s=1+1/2+1/3+1/4+.+1/n #include double fun(int n) int i;double s;s=1.0; for(i=2;i int gcd(int m,int n) int r,t;if(m0) r=m%n;m=n;n=r; return(_); -m /*$BLANK2$*/ void main() int m,n,result;printf(“Pease input two number:n“); scanf(“%d%d“,_); -printf(“result=%dn“,result); 第九套 一;求地 n 个数是多少 规律是第一个数是

10、2,从第二 个起每个数都是他前一项家 3 #include long fun(int n) if(n=1) -= = /*$ERROR1$*/return 2; else return fun()+3; - return fun(n-1)+3; /*$ERROR2$*/ void main() long m;int n;scanf(“%d“,n); -printf(“%ldn“,m); 二:删除 s 中的所有空格 #include void main() char s80; int i,j; printf(“Please input a string:“); gets(_); -s /*$BLANK1$*/for(i=0,j=0;si!=_;i+) -0 /*$BLANK2$*/ if(si != 32) sj+=si; sj=_; -0 /*$BLANK3$*/ puts(s);

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 社会民生

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号