有以下程序 #include<stdio.h> intfun(intx){ intp; if(x=0‖x=1)return(3); p=x-fun(x-2);retum(p);) main( ){ printf(’’%d\n’’,fun(9)); }

admin2014-06-18  14

问题 有以下程序
#include<stdio.h>
intfun(intx){
intp;
if(x=0‖x=1)return(3);
p=x-fun(x-2);retum(p);)
main(    ){
printf(’’%d\n’’,fun(9));
}
程序运行后的输出结果是

选项 A、5
B、9
C、4
D、7

答案D

解析 函数fun的主要功能是:初值x的值为9,因此fun(9)=9.fun(7)=9.(7.(5-(3-3))),因此答案为7。
转载请注明原文地址:https://kaotiyun.com/show/tYJp777K
0

随机试题
最新回复(0)