Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

Fibonacci Series Program. in java

//Fibonacci Series using Recursion
class fibonacci
{
    static int fib(int n)
    {
    if (n <= 1)
       return n;
    return fib(n-1) + fib(n-2);
    }
      
    public static void main (String args[])
    {
    int n = 9;
    System.out.println(fib(n));
    }
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #Fibonacci #Series #java
ADD COMMENT
Topic
Name
2+5 =