Turn Desktop View Off
by Dinesh Thakur

Fibonacci Series is series of Natural Number in the Sequence of: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55...., The first two number in Fibonacci series are 0 and 1, where next number is equivalent to sum of previous two number. in this example we use Recursion method , Recursion means calling the same function again and again to reduce the complexity of the problem solved.

Algorithm for Fibonacci Series Numbers Using Recursion:

step 1:Set a=0,b=1,c=0

step 2: Read size

step 3: Print a,b

step 4: Repeat through step-8 until (c < = size)

step 5: c=a+b

step 6: If (c < =size) then print c

step 7: Set a=b

step 8: Set b=c

step 9: Exit

Here is the Java Example for Fibonacci Series Using Recursion:

import java.util.Scanner;

public class FibonacciRecursion
                   static int a,b;
               public static void fib(int i)
                        int c=0;
                   if(i <2)
                 public static void main(String ar[])
                        int a;
                     Scanner s=new Scanner(System.in);
             System.out.print("Enter The Number of Times To print : ");
                     a=s.nextInt() ;
                     System.out.print("Fibonacci Sequence is :- ");

Fibonacci Series Using Recursion in Java