How to print fibonacci series in reverse order using recursion in TypeScript

1 Answer

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

fibo(N, 0, 1);




/*
run:

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

*/

 



answered Nov 29, 2023 by avibootz

Related questions

...