首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
下列程序的输出结果是______。 long fun5(int n) ( long s; if((n==l)‖(n==2)) s=2;
下列程序的输出结果是______。 long fun5(int n) ( long s; if((n==l)‖(n==2)) s=2;
admin
2013-06-11
22
问题
下列程序的输出结果是______。
long fun5(int n)
( long s;
if((n==l)‖(n==2))
s=2;
else
s=n+fun5(n-1);
return(s);
}
main()
{ long x;
x=fun5(4);
printf(%1d\n",x);
选项
答案
9
解析
考查if else语句,n==4不满足条件,所以fun5(4)=4+fun5(3),n==3也不满足条件,fun5(3)=3+fun5(2),n==2满足条件fun5(2)=2,故x=4+3+2=9。
转载请注明原文地址:https://kaotiyun.com/show/PjJp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
下列程序的输出结果是______。main(){inti=3;switch(i){case1:case2:printf("%d",i);case3:
下面语句的输出结果是______。printf("%d\n",strlen("\t\"065\xff\n"));
C语言源程序的最小单位是()
以下对C语言函数的有关描述中,正确的是()
现代计算机之所以能自动地连续进行数据处理,主要是因为()
计算机的软件系统一般分为()
设有以下语句typedefstructs{intg;charh;}T则下面叙述中正确的是
第一趟排序后序列中关键字最大的记录交换到最后的排序方法是______。
以下有4组用户标识符,其中合法的一组是______。
随机试题
FarewellSpeech1."Specialneeds"Commonlydefinedbywhatachildcan’tdoBymilestonesunmetBy【T1】________
下列哪些激素或因子的受体属于酪氨酸蛋白激酶受体
A、多形性腺瘤B、腺样囊腺癌C、基底细胞腺瘤D、Warthin瘤E、腺泡细胞癌含嗜酸性上皮细胞的涎腺肿瘤
以实际发生的经济业务事项为依据进行会计核算是保证会计资料质量的关键。()
“材料成本差异”科目借方核算的内容有()。
下列关于利润表项目之间关系的等式中,正确的是()。
“关注个体差异”就是根据学生实际存在的兴趣爱好和能力差异,()
公安工作大量的、经常性的工作主要是教育,这不仅是对广大群众而言,就是对违法犯罪分子在实施打击的同时,也要实行教育,以促使他们悔过自新,重新做人。()
2014年6月,洞庭湖水位迅速上涨,淹没了大片湖洲、湖滩,栖息于此的大约20亿只田鼠浩浩荡荡地涌人附近的农田,使洞庭湖沿岸的岳阳、益阳遭遇了20多年来损失最为惨重的鼠灾。专家分析说,洞庭湖的生态环境已经遭到破坏,鼠灾敲响了警钟。下面的选项如果为真
断电后会使存储数据丢失的存储器是______。
最新回复
(
0
)