1、int int facfac(int(int n n)if(if(n=1n=1)return)return 1 1;else return else return n n *facfac(n-1n-1););3.3.两个典型的递归问题两个典型的递归问题1n 11n )1(*)(nfnnf(1)(1)求求n n!int int facfac(int(int n n)if(if(n=1n=1)return)return 1 1;else return else return n n *facfac(n-1n-1););m=facm=fac(4);(4);returnreturn 4 4*facfa
2、c(3 3););returnreturn 3 3*facfac(2 2););returnreturn 2 2*facfac(1 1););returnreturn 1 1;12*13*2*14*3*2*1int int fibfib(int(int n n)if(if(n=2n=2)return return 1 1;else else return return fibfib(n-1)(n-1)+fibfib(n-2n-2););2 12n )2()1()(nnfnfnf(2)Fibonacci(2)Fibonacci序列序列int int fibfib(int(int n n)if(if(n=2n=2)return)return 1 1;else return else return fibfib(n-1)(n-1)+fibfib(n-2n-2););m=fib(4)return fib(3)+fib(2)return fib(2)+fib(1)return 1;return 1;return 1;11321