Return. Return 2 is to return the result of 2 times, 1 why
CodePudding user response:
That's what you need is to see, such as looking forward to what kind of resultsReturn is when n is 1, 2 factorial result to 2, namely 1!=2 Return 1 is when n is 1, factorial result is 1, which is 1.=1 If your need is 2 times for n factorial, then return to 2 If your demand is n factorial, then return 1
CodePudding user response:
According to the principle of recursive, return 2 and return 1 is 2 times of problem, because, after returning to 2 recursive implementation by half, The final execution is 2 x 2 x 3... X 10 Return 1 is executed: 1 * 2 * 3... * 10