1: // Created by Frank M. Carrano and Tim Henry.
2: // Copyright (c) 2013 __Pearson Education__. All rights reserved.
4: /** Computes a term in the Fibonacci sequence.
5: @pre n is a positive integer.
6: @post None.
7: @param n The given integer.
8: @return The nth Fibonacci number. */
9: int rabbit(int n)
10: {
11: if (n <= 2)
12: return 1;
13: else // n > 2, so n - 1 > 0 and n - 2 > 0
14: return rabbit(n - 1) + rabbit(n - 2);
15: } // end rabbit