    01: #include <iostream>
    02:
    03: using namespace std;
    04:
    05: /**
    06:    Computes a Fibonacci number.
    07:    @param n an integer
    08:    @return the nth Fibonacci number
    09: */
    10: int fib(int n)
    11: {
    12:    cout << "Entering fib: n = " << n << "\n";
    13:    int f;
    14:    if (n <= 2) f = 1;
    15:    else f = fib(n - 1) + fib(n - 2);
    16:    cout << "Exiting fib: n = " << n
    17:       << " return value = " << f << "\n";
    18:    return f;
    19: }
    20:
    21: int main()
    22: {
    23:    cout << "Enter n: ";
    24:    int n;
    25:    cin >> n;
    26:    int f = fib(n);
    27:    cout << "fib(" << n << ") = " << f << "\n";
    28:    return 0;
    29: }