How to print fibonacci series in reverse order using recursion in Node.js

1 Answer

0 votes
function fibo(n, a, b) {
    if (n > 0) {
        fibo(n - 1, b, a + b);
        console.log(a);
    }
}
 
let N = 12;

fibo(N, 0, 1);




/*
run:

89 
55 
34 
21 
13 
8 
5 
3 
2 
1 
1 
0 

*/

 



answered Nov 29, 2023 by avibootz
edited Nov 29, 2023 by avibootz
...