有以下程序 #include int fun(int x,int Y) { if(x==y)retum(x); else return((x+y)/2); } main() { int

admin2013-10-19  28

问题 有以下程序
    #include
    int fun(int x,int Y)
    {   if(x==y)retum(x);
        else return((x+y)/2);
    }
    main()
    {  int a=4,b=5,c=6;
       printf("%dhn",fun(2*a,fun(b,c)));
    }
    程序运行后的输出结果是

选项 A、3
B、6
C、8
D、12

答案8

解析 fun(b,c)即fun(5,6),5!=6,所以返回(5+6)/2=5;fun(2*a,5)即fun(8,5),8!=5,所以返回(8+5)/2=6。
转载请注明原文地址:https://kaotiyun.com/show/6qJp777K
0

最新回复(0)