有以下程序 #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

admin2020-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
0

最新回复(0)