Advertisement
Cinestra

Chapte4Number6

Jan 29th, 2014
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. public class Chapter4Number6
  2. {
  3. public static int fib(int n)
  4. {
  5. if ( n == 0 || n == 1)
  6. return n;
  7. return fib(n-2) + fib(n-1);
  8. }
  9.  
  10. public static void main(String[] args)
  11. {
  12. for (int n = 1; n < 10; n++)
  13. System.out.println(fib(n+1) + "/" + fib(n));
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement