Recursion

Fibonacci by Recursion

import java.util.*; 
class Fibonacci
{
 static int j;
 
 static int fibonacci(int number)
 {
  if(number <= 1)
  { 
     return number;
  }
   
   return( fibonacci(number-1)+ fibonacci(number-2) );
 }
 
 public static void main(String [] args)
 {
  System.out.print("Enter The Number : ");
  Scanner sc = new Scanner(System.in);
    j = sc.nextInt();
    System.out.print("Fibonacci Series is : ");
    for(int i=1; i<=j ; i++)
    {
      System.out.print(fibonacci(i) +" ");
    } 

   }

}