gudii9
asked on
java recursion example
Hi,
I am reading below link on java recursion
https://howtoprogramwithjava.com/java-recursion/
i wonder how and where n2 gets incremented to print fibonacci numbers as below
0,1,1,2,3,5...
please advise
I am reading below link on java recursion
https://howtoprogramwithjava.com/java-recursion/
i wonder how and where n2 gets incremented to print fibonacci numbers as below
0,1,1,2,3,5...
please advise
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
https://howtoprogramwithjava.com/java-recursion/
Actually, the code you are quoting has an index output error - line 23, as it stands in the original, should be transported up to line 5, otherwise the indexes are not printed sequentially.
Line 23 fyi, is
index++;
i wonder how and where n2 gets incrementedfibonacciSequence(n2, n1+n2);
// but it's not incremented because it is passed to a different n2
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window