资源描述:
《中职技能高考C语言月考试题.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、计算机二(7)班C语言月考试题姓名________考号________1、设计程序输出以下图案**********************2、设计程序求a+b-c的结果3、设计程序求任意长方形的周长4、设计程序比较输入的3个不同数的大小,按从大到小输出5、设计程序输出13,20,27,34……965,972,9796、设计程序输出1至600以内所有能被3而且不能被5整除的数(2)#includeintmain(){inta,t,s;a=________;t=30;s=0;while(_________){t=t+
2、a;a=a+2;}s=197-t;printf(“%d”,s)return0;}7、程序填空:求197-90-88-……-32-30的结果以下两种写法,分析程序,将横线部分补充完整。(1)#includeintmain(){inti,s;i=90;s=__________;while(i>=30){s=s-i;____________;}printf(“%d”,s)return0;}8、设计程序求2-+4-+8-+……+128-+256-的结果基本输入输出函数1、#includemain(){i
3、nta=1,b=3,c=5;if(c==a+b)printf("yes");elseprintf("no");}输出结果:2、#includemain(){inta=12,b=-34,c=56,min=0;min=a;if(min>b)min=b;if(min>c)min=c;printf("min=%d",min);}输出结果:3、#includemain(){intx=2,y=-1,z=5;if(x4、出结果:4.#includemain(){floata,b,c,t;a=3;b=7;c=1;if(a>b){t=a;a=b;b=t;}if(a>c){t=a;a=c;c=t;}if(b>c){t=b;b=c;c=t;}printf("%5.2f,%5.2f,%5.2f",a,b,c);}输出结果:5.#includemain(){floatc=3.0,d=4.0;if(c>d)c=5.0;elseif(c==d)c=6.0;elsec=7.0;printf(“%.1f”,c);}运行结果:6
5、.#includemain(){intm;scanf("%d",&m);if(m>=0){if(m%2==0)printf("%disapositiveeven",m);elseprintf("%disapositiveodd",m);}else{if(m%2==0)printf("%disanegativeeven",m);elseprintf("%disanegativeodd",m);}}若键入-9,则运行结果为:7.#includemain(){intnum=0;whil
6、e(num<=2){num++;printf("%d",num);}}8.#includemain(){intsum=10,n=1;while(n<3){sum=sum-n;n++;}printf(“%d,%d”,n,sum);}9、#includemain(){intsum=10,n=1;while(n<3){sum=sum-n;n++;}printf(“%d,%d”,n,sum);}10.#includemain(){intnum,c;scanf("%d",&num);
7、do{c=num%10;printf("%d",c);}while((num/=10)>0);printf("");}从键盘输入23,则运行结果为:11#includemain(){ints=0,a=5,n;scanf("%d",&n);do{s+=1;a=a-2;}while(a!=n);printf("%d,%d",s,a);}若输入的值1,运行结果为:#includemain(){charc;while((c=getchar())!=’$’){if(‘A’<=c&&c<=‘Z’)p
8、utchar(c);elseif(‘a’<=c&&c<=‘z’)putchar(c-32);}}如果从键盘输入abcde?FGH(回车)#includemain(){ints=0,a=6,n;scanf("%d",&n);do{s