// John Bent's CS 110 Hand-out 12 // Recursive fibonnacci sequence // // This program uses a recursive solution to return // the value of the n'th term of the fibbonacci sequence. // // Limitations - No error checking of user input. #include #include double long fib( int ); int main( ) { cout << "\nWhich term would you like to see? "; int term; cin >> term; cout << setiosflags(ios::fixed); // no scientific notation cout << setprecision(0); // no decimal places cout << "That term is:\n\t" << fib(term) << endl; return 0; } double long fib (int level) { if ( level < 3) return(1); else return ( fib( level - 1) + fib( level - 2)); }