首页
外语
计算机
考研
公务员
职业资格
财经
工程
司法
医学
专升本
自考
实用职业技能
登录
计算机
有以下程序 #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; printf
有以下程序 #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; printf
admin
2020-07-28
19
问题
有以下程序
#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;
printf( "%d\n" , fun(2*a, fun( b, c ) ) );
}
程序运行后的输出结果是( )。
选项
A、6
B、3
C、8
D、12
答案
A
解析
考查函数的调用。输出结果为fun(2*a, fun(b, c))=fun(8,5)=6,答案选A。
转载请注明原文地址:https://kaotiyun.com/show/Fm3p777K
本试题收录于:
二级C语言题库NCRE全国计算机二级分类
0
二级C语言
NCRE全国计算机二级
相关试题推荐
给定程序中,函数fun的功能是:在形参SS所指字符串数组中,删除所有串长超过k的字符串,函数返回所剩字符串的个数。ss所指字符串数组中共有N个字符串,且串长小于M。请在程序的下划线处填入正确的内容并把下划线删除,使程序得出正确的结果。注
给定程序中,函数fun的功能是将参数给定的字符串、整数、浮点数写到文本文件中,再用字符串方式从此文本文件中逐个读入,并调用库函数atoi和atof将字符串转换成相应的整数、浮点数,然后将其显示在屏幕上。请在程序的下划线处填入正确的内容并把下划线删
有以下程序intf(intx);main(){intn=1,m;m=f(f(f(n)));printf("%d\n",m);}intf(intx){returnx*2;}程序运行后的输出结果是
已定义以下函数intfun(int*p){return*p;}fun函数返回值是
以下关于return语句的叙述中正确的是
若有以下定义和语句chars1[10]="abcd!",*s2="\n123\\";printf("%d%d\n",strlen(s1),strlen(s2));则输出结果是
有下列程序:main(){inta[4][4]={{l,4,3,2},{8,6,5,7},{3,7,2,5},{4,8,6,1}},i,j,k,t;for(i=0;i<4;i++)for(j=0;j<3;j++)for(k=j+1;k
有以下程序#include<stdio.h>#defineN4voidfun(inta[][N],intb[]){inti;for(i=0;i<N;i++)b[i]=a[i][i]-a[i][N-1-i];}void
随机试题
纤维素性血栓主要发生在以下哪个部位()
肝性脑病患者可采取下列何种溶液灌肠( )。
()收集整理竣工验收文件,并进行立卷归档。
图纸会审和设计交底应由()来组织进行。
期货公司设立分支机构时,可以按一定标准计算风险资本准备。()
目前,中国理财师队伍普遍老龄化。()
绊脚石也可以成为垫脚石,请说说你对这句话的理解,以及这句话对你有什么启示。(2011年7月2日下午湖南省公务员面试真题)
有以下程序:#includevoidex(inta,intb){intt;t=a;a=b;b=t;}main(){intc[8]={8,7,6,5,4,3,2,1},i;for(i=0;i<8;i+=2)ex(c[i],c[i+
Mondayisbeginningoftheworkweek:it’s【C1】______daymostpeoplelike【C2】______.It’snot【C3】______thatthedaytheylikemost
近几年,频发的自然灾害令全球深受其害。炎热的酷暑、狂暴的飓风、刺骨的严寒以及滔天的洪水近乎成了“常客”,而风调雨顺已被人们视为“奢侈品”。对全球范围内出现的极端灾害天气现象,各国气象学家们众说纷纭。有的说是全球变暖所致,有的归因于大气环流异常,还有
最新回复
(
0
)