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:    if (n <= 2) return 1;
13:    else return fib(n - 1) + fib(n - 2);
14: }
15: 
16: int main()
17: {  
18:    cout << "Enter n: ";
19:    int n;
20:    cin >> n;
21:    int f = fib(n);
22:    cout << "fib(" << n << ") = " << f << endl;
23:    return 0;
24: }