Java Programs

Write a Java program to find the Fibonacci series


/*Java Program to find the FibonacciSeries */
public class FibonacciSeries {
   public static void main(String a[]){   
         int limit = 15; /* give limit here */
         int[] feb = new int[limit];
         feb[0] = 0;
         feb[1] = 1;
   /* store all elements in array feb[] */
         for(int i=2; i < limit; i++){
             feb[i] = feb[i-1] + feb[i-2];
         }
    /* print all array elements */
         for(int i=0; i< limit; i++){
                 System.out.print(feb[i] + " ");
         }
    }
}
www.000webhost.com