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