0) {switch(s) { case 1:printf("%d",s+5); " />
有以下程序 #include void main() {int s; scanf("%d",&s); while(s>0) {switch(s) { case 1:printf("%d",s+5);
首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
0) {switch(s) { case 1:printf("%d",s+5); ">有以下程序 #include void main() {int s; scanf("%d",&s); while(s>0) {switch(s) { case 1:printf("%d",s+5);
有以下程序 #include void main() {int s; scanf("%d",&s); while(s>0) {switch(s) { case 1:printf("%d",s+5);
admin
2018-01-11
30
问题
有以下程序
#include
void main()
{int s;
scanf("%d",&s);
while(s>0)
{switch(s) {
case 1:printf("%d",s+5);
case 2:printf("%d",s+4);break;
case 3:printf("%d",s+3);
default:printf("%d",s+1);break;
}
scanf("%d",&s);}}
运行时,若输入1 2 3 4 5 0,则输出结果是
选项
A、66656
B、6566456
C、66666
D、6666656
答案
B
解析
这道试题主要考查了switch和break语句,当变量s的值为1时,执行case1、case 2两条语句,输出65:当变量s的值为2时,执行case 2语句,输出6:变量s的值为3时,执行case3、default两条语句,输出64;变量s的值为4时,执行default语句,输入5;变量s的值为5时,执行default语句,输出6;变量s的值为0时,程序运行结束。
转载请注明原文地址:https://kaotiyun.com/show/SUxp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
软件设计模块化的目的是________程序设计的复杂性。
有下列程序:fun(intx,inty){return(x+y);)main(){inta=1,b=2,c=3,sum;sum=fun((a++,b++,a+b),c++);print
下列程序的运行结果是_________。#includelongfunc(intx){longp;if(x==0‖x==1)return(1);p=x*
以下程序的输出结果是()。main(){char*s="12134211";intv[4]={0,0,0,0},k,i;for(k=0;s[k];k++){switch(s
有以下程序:voidfun(char*a,char*b){a=b;(*a)++;}main(){charc1=’A’,c2=’a’,*p1,*p2;p1=&c1;p2=*c2;fun(p1,p2);print
下列程序的功能是:求出数组x中各相邻两个元素的和,依次存放到a数组中,然后输出。请填空。main(){intx[10],a[9],i;for(i=0;i<10;i++)scanf("%d",&x[i]);for(_
若有以下程序:inta=,b=2;a=a^b;b=b^a;则执行以上语句后a和b的值分别是()。
设有定义语句:“inta[][3]={{0),{1),{2});”,则数组元素a[1][2]的值是_________。
若已定义的函数有返回值,则以下关于该函数调用叙述中错误的是
设a=1,b=2,c=3,d=4,则表达式a<b?a:c<d?a:d的结果为______。
随机试题
大雾天在高速公路遇事故不能继续行驶时怎样处置?
以下哪种疾病不属于结缔组织疾病:
脊柱侧凸最常见的类型是
中药全浸膏粉制颗粒,常选用的润湿剂是
项目还本资金来源主要有()。
按国家建设部规定,工程项目总造价中应预留()的尾留款作为质量保修费,待工程项目保修期结束后最后拨付。
2014年7月1日,某公司按面值发行总额为6000万元,期限为5年,票面年利率为5%,到期一次还本付息的债券。2015年12月31日,该债券的账面价值为()万元。
Toavoidthevariousfoolishopinionstowhichmanisliable,nosuperhumangeniusisrequired.Afewsimpleruleswillkeepyou
Menhavedistinguishedthemselvesfromotheranimals,andindoingsosecuredtheirsurvivalbytheabilitytoobserveandunder
Formanypeopletoday,readingisnolonger【S1】______.Tokeepuptheirworktheymustreadletters,reports,tradepublicatio
最新回复
(
0
)