Home > Back-end >  Function recursive, strives for the class
Function recursive, strives for the class

Time:10-19

The fac (int n) function inside the
F=f * n.
Return (f);
The specific said what mean?

Why do some factorial recursive calls is
F=fac (n - 1) * n;

CodePudding user response:

Return is the result of the function, the recursion is the results and to call a function as a parameter

CodePudding user response:

reference 1st floor qq_46221910 response:
return is the result of the function, the recursion is the result and the called function as a parameter to

I just can't get it returned, if 3! F=3 * 2 * 1, the 2 come from?

CodePudding user response:

refer to the second floor weixin_46360087 response:
Quote: refer to 1st floor qq_46221910 response:
return is the result of the function, the recursion is the result and the called function as a parameter to

I just can't get it returned, if 3! F=3 * 2 * 1, the 2 come from?

2 is I=2 on a few, I=1 f multiplied by 1, I=3 when multiplied by 3

CodePudding user response:

reference qq_46221910 reply: 3/f
Quote: refer to the second floor weixin_46360087 response:
Quote: refer to 1st floor qq_46221910 response:
return is the result of the function, the recursion is the result and the called function as a parameter to

I just can't get it returned, if 3! F=3 * 2 * 1, the 2 come from?

2 is I=2 on a few, I=1 f multiplied by 1, I=3 when multiplied by 3

Didn't understand,,

CodePudding user response:

This kind of your drawing is better understood, like this

CodePudding user response:

reference qq_46221910 reply: 3/f
Quote: refer to the second floor weixin_46360087 response:
Quote: refer to 1st floor qq_46221910 response:
return is the result of the function, the recursion is the result and the called function as a parameter to

I just can't get it returned, if 3! F=3 * 2 * 1, the 2 come from?

2 is I=2 on a few, I=1 f multiplied by 1, I=3 when multiplied by 3

Below a for loop, isn't it, every time I change fac (I) also changed, and the role of fac (I) is multiplied by the I

CodePudding user response:

Topic request output from 1 to 5 classes, for loop should have nothing to do with class, I'm meng

CodePudding user response:

This... Can you explain it?

CodePudding user response:

reference 5 floor and 蘤 old crepe reply:
this your drawing is better understood, like this


Uncle, I see, thank you for reminding me
  • Related