首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序: #include int fun(int x,int y) { if(x!=y)return((x+y)/2); else return(x); } main() { int a=4,b=5,c=6; pfinff("%d\n",fun(
有以下程序: #include int fun(int x,int y) { if(x!=y)return((x+y)/2); else return(x); } main() { int a=4,b=5,c=6; pfinff("%d\n",fun(
admin
2015-07-30
18
问题
有以下程序:
#include
int fun(int x,int y)
{ if(x!=y)return((x+y)/2);
else return(x);
}
main()
{ int a=4,b=5,c=6;
pfinff("%d\n",fun(2*a,fun(b,c)));
}
程序运行后的输出结果是( )。
选项
A、6
B、3
C、8
D、12
答案
A
解析
本题中第一次调用为fun(8,fun(5,6)),因为fun(5,6)返回值为5,所以第二次调用为fun(8,5)=6。所以选择答案A。
转载请注明原文地址:https://kaotiyun.com/show/xsDp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
在学生管理的关系数据库中,存取一个学生信息的数据单位是
二分法查找仅限于这样的表:表中的数据元素必须有序,其存储结构必须是______。
下列二维数组初始化语句中,不正确的是()。
下列程序的输出结果是()。#include<stdio.h>voidp(int*x){printf("%d",++*x);}voidmain(){inty=3;
有下列二叉树,对此二叉树前序遍历的结果为()。
按照“先进后出”原则组织数据的数据结构是()。
算法的复杂度主要包括时间复杂度和______复杂度。
在数据流图(DFD)中,带有名字的箭头表示______。
数据流图的类型有______和事务型。
下列不属于C语言关键字的选项是()。
随机试题
Thebuildingis______thatone.
A.梗死灶呈节段性B.梗死易液化C.梗死灶呈锥形D.梗死灶呈地图状肠梗死
对脱水剂环己酮的描述,下面不正确的是
说明该订约过程之要约邀请、要约和承诺。是否成立买卖合同,并给出法律依据。
根据《人民法院工作人员处分条例》的规定,下列对法官的纪律处分中执行正确的是哪一或哪些选项?()
财政政策的基本内容是()。
与失眠不符合的是()。
“一个苹果让牛顿吸引了世界,一壶沸水让瓦特转动了世界,一个元素让爱迪生点燃了世界……”该广告词中爱迪生的贡献是()。
根据所给图表、文字资料,回答96-100题2009年度全国旅行社营业收入为1806.53亿元,同比增长8.64%;毛利润总额为134.36亿元,毛利率为7.44%;净利润总额为11.48亿元,净利润为0.64%。2009年度全国旅行社的旅游
一次义演音乐会上,有七个歌手H、J、M、N、S、T和W要演唱。音乐会导演将他们的演唱编成连续的七个节目,依据下列条件安排了他们的演唱次序:(1)H必须在M之前演唱。(2)S必须在J之前演唱。(3)T必须紧接在N之前或之后演唱。(4)W必须第三个演唱
最新回复
(
0
)