#include<iostream>
using namespace std;
// Compute Nth number in Fibonacci sequence
int fib(int N);
int main()
{
int sequenceNumber;
// Ask user which number N in the Fibonacci
// sequence s/he wants to see
cout << "What number in the Fibonacci sequence do you want to see? ";
cin >> sequenceNumber;
// Report the Nth number in the sequence
cout << "The " << sequenceNumber << "th number"
<< " in the Fibonacci sequence is: " << fib(sequenceNumber) << endl;
return 0;
}
// Return Nth number in Fibonacci sequence,
// assuming N is a positive integer
int fib(int N)
{
if(N==1 || N==2) // base cases: first two terms are 1
return 1;
else // recursive case: fN=fN-1+fN-2
return fib(N-1)+fib(N-2);
}