Code /* Fibonacci2.cpp CIS 250 Dave Klick 2008-03-24 This program uses recursion to calculate Fibonacci numbers, and allows the series to start with any two integers. */ #include #include using std::cout; using std::endl; using std::cin; long fib(long a, long b, long n); int main(void) { long a, b, n; cout << "This program calculates Fibonacci numbers\n"; cout << "Please enter the first number in the series: "; cin >> a; cout << "Please enter the second number in the series: "; cin >> b; cout << "Please enter the position of the Fibonacci number you want: "; cin >> n; cout << "The answer is " << fib(a,b,n) << endl; return 0; } long fib(long a, long b, long n) { assert (n > 0); if (n == 1) return a; if (n == 2) return b; return fib(a,b,n-1) + fib(a,b,n-2); }