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