Fibonacci series

Fibonacci series...
public class Fibonacci{
 public void printFibonacci(int min,int max)
 {
  for(int i=min;i<=max;i++)
   System.out.println("Fibonacci number is : "+fibo(i));
 }

 private long fibo(int n)
 {
  if(n<=1)
   return 0;
  if(n==2)
   return 1;
  else
   return fibo(n-1)+fibo(n-2);
 }
}

Reactions

Post a Comment

0 Comments