Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Chapter4Number6
- {
- public static int fib(int n)
- {
- if ( n == 0 || n == 1)
- return n;
- return fib(n-2) + fib(n-1);
- }
- public static void main(String[] args)
- {
- for (int n = 1; n < 10; n++)
- System.out.println(fib(n+1) + "/" + fib(n));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement