有以下程序 #include int fun(int x){ int p; if(x==0 ‖ x==1)return(3); p=x-fun(x-2);return(p);} main(){

admin2020-11-23  24

问题 有以下程序
    #include
    int fun(int x){
      int p;
      if(x==0 ‖ x==1)return(3);
      p=x-fun(x-2);return(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/6y3p777K
0

随机试题
最新回复(0)