首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序: #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
有以下程序: #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
admin
2022-10-24
41
问题
有以下程序:
#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、6
B、3
C、8
D、12
答案
A
解析
本题中,fun函数第1次调用为fun(8,fun(5,6))。因为fun(5,6)的返回值为5,所以第2次调用为fun(8,5),即返回值为6。故本题答案为A选项。
转载请注明原文地址:https://kaotiyun.com/show/lWkp777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
有以下程序main(){inty=10;while(y--);printf("y=%d\n",y);}程序执行后的输出结果是
若变量已正确定义,有以下程序段i=0;doprintf("%d,",i);while(i++);printf("%d\n",i);其输出结果是
有以下程序#include#includemain(){int*a,*b,*c;a=b=c=(int*)malloc(sizeof(int));*a=1;*b=2,*c=3;a
数据库设计的根本目标是要解决
设一棵完全二叉树共有700个结点,则此二叉树中的叶子结点数为
使用VC++2010打开考生文件夹下prog1中的解决方案。此解决方案的项目中包含一个源程序文件prog1.c。在此程序中,编写函数fun,它的功能是:求小于形参n同时能被3与7整除的所有自然数之和的平方根,并作为函数值返回。例如,若n为1000
使用VC++2010打开考生文件夹下blank1中的解决方案。此解决方案的项目中包含一个源程序文件blank1.c。在此程序中,函数fun的功能是:将不带头节点的单向链表节点数据域中的数据从小到大排序。即若原链表节点数据域从头至尾的数据为10、4、2、8、
使用VC++2010打开考生文件夹下blank1中的解决方案。此解决方案的项目中包含一个源程序文件blank1.c。在此程序中,函数fun的功能是:把形参a所指数组中的奇数按原顺序依次存放到a[0]、a[1]、a[2]..…•中,把偶数从数组中删除,奇数个
下列叙述中错误的是()。
有二叉树如下图所示:则前序序列为()。
随机试题
新中国成立后,毛泽东指出我国工人阶级和民族资产阶级的矛盾属于()
期货投机交易应遵循的原则有()。
金融市场为市场参与者提供风险补偿机制,其实现方式有()。
思维发展成熟的阶段是()。
国家对农民的粮食资助力度不断提高,为什么农民还说“拿到手的就那么一点”?谈谈你的看法。
数学方法是西方科学中极其重要和不可或缺的方法,严谨和精确是科学精神的重要组成部分,而严谨和精确在很大程度上是由数学方法带来的。科学要求各种概念尽可能被定量且能以一定的精确性加以检验。定律和定理的精确性体现在它的数学表达上。实验测定值与定律和定理的数学推定值
在我国,能够成为法律关系主体的有()
•Readthesalaryoffernegotiation.•Inmostofthelines34-45,thereisoneextraword.Itiseithergrammaticallyincorrect
A、Thegiftcard’svaliditytimeisshort.B、Thegiftcardhasafewchancestouse.C、Shoppershavetopaygiftcardfees.D、The
Energyindependence.Ithasaniceringtoit,doesn’tit?Ifyouthinkso,you’renotalone,becauseenergyindependencehasbe
最新回复
(
0
)