Fabonacci series in Java


 public static void main(String aa[])
 {
  int i=1,j=1;
  System.out.print(i+ ",");
  System.out.print(j+ ",");
  while(i<100)
  {
   i=i+j;
   if(i<100)
   {
   System.out.print(i+ " , ");
   }
   j=i-j;
   
  }
    }

No comments :

No comments :

Post a Comment