home *** CD-ROM | disk | FTP | other *** search
/ BUG 15 / BUGCD1998_06.ISO / aplic / jbuilder / jsamples.z / Fibonacci.java < prev    next >
Encoding:
Java Source  |  1997-07-23  |  261 b   |  13 lines

  1. public class Fibonacci
  2. {
  3.     /*
  4.      * Not the most efficient implementation of the Fibonacci numbers...
  5.      */
  6.     static int Fib(int n)
  7.     {
  8.         if (n == 0) return 0;
  9.         if (n == 1) return 1;
  10.         return Fib(n-1) + Fib(n-2);
  11.     }
  12. }
  13.