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