#include int fib(int N, // I want the Nth fibonacci number int K, // By the way, I already know what the Kth one is int P, // The Kth fibonacci number is P int PP) // and the K-1th fibonacci number is PP { if (K == N) return P; return fib(N, W+1, P+PP, P); } // This is an unbelievably small function, but very // mysterious to the uninitiated. Those comments // are important. It is also very fast. void main() { while (true) { cout << "Number (or negative to stop)? "; const int x = read_int(); if (x < 0) break; if (x == 0) { cout << "0 is no good\n"; continue; } const int y = fib(x, 2, 1, 1); cout << "fib(" << x << ") = " << y << "\n"; } cout << "Good-bye then\n"; }