填空题 以下程序运行后的输出结果是{{U}} {{/U}}。
#include <stdio.h>
fun(int x)
if(x/2>0) fun(x/2);
printf("%d",x);

main()
fun(6);

  • 1、
【正确答案】 1、1 3 6    
【答案解析】[解析] 程序中定义了一个递归调用函数fun。程序运行时,先把实参6传给形参。if语句中6/2>0成立,执行fun(x/2),即fun(3),同时输出x的值6;再判断if条件,3/2>0成立,再执行fun(x/2),即fun(1),同时输出x的值3;此时1/2>0不再成立,输出1。而递归调用的输出顺序是相反的,故输出结果为1 3 6。