C语言程序设计题目及解答-05

上传人:tia****nde 文档编号:36947657 上传时间:2018-04-04 格式:DOC 页数:7 大小:87.50KB
返回 下载 相关 举报
C语言程序设计题目及解答-05_第1页
第1页 / 共7页
C语言程序设计题目及解答-05_第2页
第2页 / 共7页
C语言程序设计题目及解答-05_第3页
第3页 / 共7页
C语言程序设计题目及解答-05_第4页
第4页 / 共7页
C语言程序设计题目及解答-05_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《C语言程序设计题目及解答-05》由会员分享,可在线阅读,更多相关《C语言程序设计题目及解答-05(7页珍藏版)》请在金锄头文库上搜索。

1、一、判断题一、判断题 (6 分分) 1. 在多重循环结构中,使用 break 语句,可以跳出整个循环。2 分 2. 多重循环是指循环语句的循环体中,又嵌套了另一个或多个循环语句,多个内层循环可 以相互交叉嵌套。2 分 3. continue 语句用在循环体中,可使整个循环不结束。2 分 二、选择题二、选择题 (16 分分) 1.在 C 语言的循环语句 for,while,do-while 语句中,用于直接中断最内层循环的语句是:C A. switch B. continue C. break D. if 2.请读程序:#include main()int a, b ;for(a = 1 , b

2、 = 1 ; a = 20) break ;if (b%3 = 1) b += 3 ; continue ; b -= 5 ;printf(“%d“, a) ; 上面程序的输出结果是_。 B 2 分 A. 7 B. 8 C. 9 D. 10 3.以下程序中,while 循环的循环次数是_。 D 2 分 main() int i=0;while(i main() int i=0,a=0;while(ibc)printf(“%dn“,d);else if(c-1=d)=1)printf(“%dn“,d+1);else printf(“%dn“,d+2); 执行后输出的结果是_。 B 2 分 A.

3、2 B. 3 C. 4 D. 编译时有错,无结果 7.有以下程序 main() int i=0,s=0;doif(i%2)i+;continue;i+;s+=i; while(i void main() int i,j,_(1)_;printf(“n“);for (i=1;_(2)_;i+) for(j=1;j void main( ) int a, i, b, n ;printf(“Friendly-numbers pair samller than 3000:n“) ;for(a=1 ; a int main() long f,s;int i,j,n;_(1)_;scanf(“%d“, f

4、or(i=1;i int main() int cocks,hens,chicks;cocks=0;while(cocks void main() int i,j,k,n=0;for(i=0;i %d,%d,%dn“,+n,i,j,k); (1)答案 3 分 i+j void main() int a,b,i,n,c=0,f=1; scanf(“%d%d“, for(n=a;n void main() int a,b,i,j,k=0;scanf(“%d %d“,for(i=a;i void main() int n,sum=0,i;scanf(“%d“,for(i=1;i=n;i+)sum+=i;printf(“%dn“,sum);

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

当前位置:首页 > 中学教育 > 试题/考题

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