问题
填空题
下面是用来计算n的阶乘的递归函数,请将该函数的定义补充完整。(注:阶乘的定义是n!cn*(n-1)*...*2*1)
unsigned fact(unsigned n)
if (n<=1)
return 1;
return 【12】 ;
答案
参考答案:n*fact(n-1)或者fact(n-1)*n或者n*fact(-1+n)或者fact(-1+n)*n
解析: 递归的使用。