Lecture 18 Flashcards
1
Q
Fibonacci using recursion code
A
int fibonacci(int n) { if(n == 0 || n == 1) { return 1; } else { return fibonacci(n-2) + fibonacci(n-1); } }
Fibonacci using recursion code
int fibonacci(int n) { if(n == 0 || n == 1) { return 1; } else { return fibonacci(n-2) + fibonacci(n-1); } }