首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #include <stdio.h> int fun (int x, int y ) { if (x!=y) return ( (x+y) /2 ); else return
有以下程序 #include <stdio.h> int fun (int x, int y ) { if (x!=y) return ( (x+y) /2 ); else return
admin
2020-10-26
12
问题
有以下程序
#include <stdio.h>
int fun (int x, int y )
{ if (x!=y) return ( (x+y) /2 );
else return ( x );
}
main()
{ int a=4, b=5, c=6;
printf( "%d\n" , fun(2*a, fun( b, c ) ) );
}
程序运行后的输出结果是
选项
A、3
B、6
C、8
D、12
答案
B
解析
fun函数的功能是获取二个数的平均数,注意平均数是整型数,小数会被截断。fun(2*4,fun(5,6)):fun(8,5):6,因此答案为C选项
转载请注明原文地址:https://kaotiyun.com/show/u33p777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
以下选项中,能用作数据常量的是()。
有如下定义:structst{charname[12];intage;charsex;}std[10],*p=std;以下语句错误的是()。
有以下程序:#include<stdio.h>main(){intx=1,y=0;if(!x)y++;elseif(x==0)y+=2:elsey
支持子程序调用的数据结构是()。
以下叙述中错误的是()。
以下叙述错误的是()。
如图所示:带有头结点的单向链表head,其三个数据结点A、B、C的连接关系见图。结点类型的定义为:structlink{doubledt;struetlink,*next;};若指针p指向A结点,在不改变P指向的前提下,以下选项中不能
以下选项中叙述错误的是()。
算法空间复杂度的度量方法是()。
随机试题
Humanfeelingsareaffectedbycolorunconsciously.Manufacturershavediscoveredbytrialanderrorthatsugarsellsbadlying
咳铁锈色痰常见于
患者,男性,26岁,上唇痈6天。下列哪项处理不正确
上感3周后出现皮肤瘀点,血小板检查为30×109/L,骨髓象示骨髓巨核细胞数量轻度增加,巨核细胞发育成熟障碍。曾服用药物治疗,症状时轻时重,反复发作,就诊时表现为斑色暗淡,多散在出现,时起时消,过劳则加重,心悸,气短,头晕目眩,食欲不振,面色苍白,舌质淡,
凡士林基质中加入羊毛脂是为了
下列费用偏差原因,属于施工原因的是()。
根据物权法律制度的规定,下列关于质权设立时间的表述中,正确的有()。(2007年)
对待工作岗位,正确的观点是()。
国家机器的形成,是警察产生的()条件。
1,5,7,17,()
最新回复
(
0
)