votako

fib most final

Feb 11th, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.33 KB | None | 0 0
  1. public class Test{
  2.  
  3.     static int fib(int n) {
  4.         if(n == 0) return 1;
  5.         if(n == 1) return 1;
  6.         if(n == 2) return 1;
  7.            
  8.         int in = fib(n - 1) + fib(n - 2);
  9.         System.out.println(in);
  10.         return in;
  11.     }
  12.  
  13.     public static void main(String[] args) {
  14.         Test.fib(21);
  15.     }
  16.  
  17. }
Advertisement
Add Comment
Please, Sign In to add comment