Output: Fibonacci till 20: 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 Program: import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { final int LIMIT = 20; int[] fib = new int[LIMIT]; // init fib 0 and first val fib[0] = 0; fib[1] = 1; for (int i = 2; i < LIMIT; ++i) { fib[i] = fib[i - 1] + fib[i - 2]; } System.out.println(\"Fibonacci till \" + LIMIT + \":\"); for (int i = 0; i < LIMIT; ++i) { System.out.println(fib[i]); } } } Iterative solution is more efficient than recursive. The iterative solution do not compute the same values again and again as recursive solution. Also because we are not using recursion the os stack is not used hence computation is faster. Solution Output: Fibonacci till 20: 0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 Program: import java.util.*; import java.lang.*; import java.io.*; public class Main { public static void main (String[] args) throws java.lang.Exception { final int LIMIT = 20; int[] fib = new int[LIMIT]; // init fib 0 and first val fib[0] = 0; fib[1] = 1; for (int i = 2; i < LIMIT; ++i) { fib[i] = fib[i - 1] + fib[i - 2]; } System.out.println(\"Fibonacci till \" + LIMIT + \":\"); for (int i = 0; i < LIMIT; ++i) { System.out.println(fib[i]); } } } Iterative solution is more efficient than recursive. The iterative solution do not compute the same values again and again as recursive solution. Also because we are not using recursion the os stack is not used hence computation is faster..