// Fibonacci Sequence // public class Program1 { public static void main(String[] args) { int[] F = new int[31]; // Calculate the Sequence // F[0] - is not used F[1]=1; F[2]=1; for(int n=3; n<=30; n++) F[n] = F[n-2]+F[n-1]; // calculated using previous elements //Print the Sequence for(int n=1; n<=30; n++) System.out.println(F[n] + " "); } }