Before before the first before before the first before 5
Before before the first before before the first before the 4
Before before the first before before the first before 3
Before before the first before before the first before the 2
Before before the first before before the first before 1
After after after after after after 1 1
Before before the first before before the first before the 2
Before before the first before before the first before 1
Before before the first before before the first before the 2
After after after after after after 2 1
Before before the first before before the first before 3
Before before the first before before the first before the 2
Before before the first before before the first before 1
After after after after after after 1 1
Before before the first before before the first before the 2
Before before the first before before the first before 1
Before before the first before before the first before the 2
Before before the first before before the first before 3
Before before the first before before the first before the 2
Before before the first before before the first before 1
After after after after after after 1 1
Before before the first before before the first before the 2
Before before the first before before the first before 1
After after after after after after 3 2
Before before the first before before the first before the 4
Before before the first before before the first before 3
Before before the first before before the first before the 2
Before before the first before before the first before 1
After after after after after after 1 1
Before before the first before before the first before the 2
Before before the first before before the first before 1
Before before the first before before the first before the 2
After after after after after after 2 1
Before before the first before before the first before 3
Before before the first before before the first before the 2
Before before the first before before the first before 1
After after after after after after 1 1
Before before the first before before the first before the 2
Before before the first before before the first before 1
Before before the first before before the first before the 2
Before before the first before before the first before 3
Before before the first before before the first before the 2
Before before the first before before the first before 1
After after after after after after 1 1
Before before the first before before the first before the 2
Before before the first before before the first before 1
5
The Process finished with exit code 0
Is a Fibonacci, pass an integer N, it is concluded that the NTH Fibonacci is.
The execution order good strange, 5,1,3,1,3,1,6,1,2,1,4,1,3,1,3,1,6,1,2. Whether the stack of generated 40 FBN () the block of code?
He carried out the progressive good strange, n and finally into 1 and 1, and 1 + 1 to return to the main should be 2, 5 is how to return
CodePudding user response:
37 a function call, then execute the nine times the else54321 also can understand every time minus 1, 2 1 2 what is the change of the ghost..
CodePudding user response:
You again have a good look at the recursiveYou can put the
FMT. Println ((a: "after,,,,," FBN (n - 1), FBN (n - 2))
This sentence to pass parameters FBN (n - 1), FBN (n - 2) and see what is the difference between
Tip: the printing of FBN (n - 1), FBN (n - 2) have also been recursion, so the print information is not as you imagine, you have a good smooth your watch
CodePudding user response:
2 floor correct expression repeated calls to cause multiple recursive so the execution result is not the result you want