123456789101112131415161718192021222324252627282930313233343536
using namespace std; double fib(double n); int main() { double n; double answer; cout << "Enter number to fing: "; cin >> n; cin.ignore(); cout << "\n\n"; answer = fib(n) cout << answer << " is the " << n << "th Fibonacci number\n"; return 0; } double fib (double n) { cout << "Processing fib("<<n<<")..."; if (n < 1000000) { answer = fib(n); return (1); } else { cout << "FATAL ERROR!!("<<n-2<<")FATAL ERROR!!("<<n-1<<")$$$$$$011000100$0111000\n"; return(fib(n-2) + fib(n-1)); } }
return(fib(n-2) + fib(n-1));