Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  fibo.java
Language: JAVA
Code:
import java.util.Scanner;
class fibo
{
     public static void main(String ag[])
     {
          int a[]=new int[10000];
          int lb,hb;
          Scanner s=new Scanner(System.in);
          a[1]=1;
          a[2]=1;
          for(int i=3;i<10000;i++)
          {
               a[i]=a[i-1]+a[i-2];
          }
          System.out.println("lb");
          lb=s.nextInt();
          System.out.println("hb");
          hb=s.nextInt();
          int e=1;
          int b[]=new int[10000];
          for(int j=lb;j<=hb;j++)
          {
               b[e]=a[j];
               e++;
          }
          int l;
          System.out.println("L");
          l=s.nextInt();
          if(l==1)
          {
               System.out.println(b[1]);
          }
          else
          {
               for(int k=1;k<l;k++)
               {
                    System.out.println(b[k]);
               }
          }
     }
}
Comments: