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;
- if(n == 2) return 1;
- int in = fib(n - 1) + fib(n - 2);
- System.out.println(in);
- return in;
- }
- public static void main(String[] args) {
- Test.fib(21);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment