Function to calculate the nth Fibonacci number
| 21 | |
| 22 | // Function to calculate the nth Fibonacci number |
| 23 | int fibonacci(int n) { |
| 24 | CTRACK; // Start tracking this function |
| 25 | if (n <= 1) return n; |
| 26 | return fibonacci(n - 1) + fibonacci(n - 2); |
| 27 | } |
| 28 | |
| 29 | int main() { |
| 30 |