首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序: #include<stdio.h> main() { int a,b; for(a=0;a<3;a++) { scanf("%d",&b); swit
有以下程序: #include<stdio.h> main() { int a,b; for(a=0;a<3;a++) { scanf("%d",&b); swit
admin
2019-01-11
19
问题
有以下程序:
#include<stdio.h>
main()
{
int a,b;
for(a=0;a<3;a++)
{
scanf("%d",&b);
switch(b)
{
default:printf("%d",++b);
case 1:printf("%d",++b);
case 2:printf("%d",++b);
}
}
}
执行时输入:1 2 3<回车>,则输出结果是( )。
选项
A、2 3 3 4 5 6
B、2 3 4
C、2 2 3 4 4 4
D、2 3 4 3 4 4
答案
A
解析
本题是一个循环结构嵌套选择结构,按照外层循环,内层选择一步一步处理即可。重点注意地是,switch语句中并没有出现break语句,所以内层循环是不会跳出的。
转载请注明原文地址:https://kaotiyun.com/show/Y7xp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
请编写函数fun,它的功能是:求出能整除形参x且不是偶数的各整数,并按从小到大的顺序放在pp所指的数组中,这些除数的个数通过形参n返回。例如,若x中的值为:35,则有4个数符合要求,它们是:1,5,7,35。注意:部分源程序在文件PRO
给定程序MODll.C中函数fun的功能是:计算并输出下列级数的前N项之和sN,直到SN+1大于q为止,q的值通过形参传入。例如,若q的值为:50.0,则函数值为:49.394948。请改正程序中的错误,使程序能输出正确的结果。
给定程序MODll.c中函数fun的功能是:找出一个大于形参m且紧随m的素数,并作为函数值返回。请改正程序中的错误,使它能得出正确的结果。注意:不要改动main函数,不得增行或删行,也不得更改程序的结构!#includeintf
给定程序中,函数fun的功能是:求出形参ss所指字符串数组中最长字符串的长度,将其余字符串右边用字符*补齐,使其与最长的字符串等长。ss所指字符串数组中共有M个字符串,且串长
按照“先进先出”的原则组织数据的结构是______。
当变量c的值不为2、4、6时,值也为“真”的表达式是( )。
若有定义intm=5,y=2,则执行表达式y+=y-=m*=y后,y的值为【】。
设变量已正确定义并赋值,以下正确的表达式是
若有定义:inta=4,b=5;floatx=3.4,y=2.1;,则下列表达式的值为()(float)(a+b)/2+(int)×%(int)y
下列数据结构中,属于非线性结构的是()。
随机试题
根据《突发公共卫生事件应急条例》,突发公共卫生事件发生后,具体负责组织突发公共卫生事件查、控制和医疗救治工作的部门是县级以上地方人民政府()。
内部控制的目标不包括()
WWW浏览器有使用获取______上的各种资源。
A.先兆流产B.不全流C.稽留流产D.难免流产E.完全流产妊娠后阴道出血,量多,伴有组织块,检查子宫小于停经月份,宫口松软,有活动性出血。可能的诊断是
有关解剖学方位的描述,错误的是
A公司经常派业务员小赵与B公司订立合同。小赵调离后,又持盖有A公司公章的合同书与尚不知其已调离的B公司订立一份合同,并按照通常做法提走货款,后逃匿。对此A公司并不知情。B公司要求A公司履行合同,A公司认为该合同与己无关,予以拒绝。下列说法正确的是()。
设防烈度为7度时的毛料石砌体房屋总高度和层数不宜超过()。
下面关于电子邮件和即时通讯的说法正确的有()。
根据企业所得税的有关规定,下列各项中,属于免税收入的有()。
A、 B、 C、 D、 B
最新回复
(
0
)