Java Fibonacci Sequence Get fib(int n)

Here you can find the source of fib(int n)

Description

fib

License

Open Source License

Declaration

public static int fib(int n) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static int fib(int n) {
        if (n == 0)
            return 0;
        else if (n == 1)
            return 1;
        else/*from   w  w  w  .ja v a 2 s .  c o m*/
            return fib(n - 1) + fib(n - 2);
    }
}

Related

  1. esFibo(long value)
  2. fiboCercano(long numero)
  3. fibonacci(int n)
  4. fibonacci(int n)
  5. fibonacci(int n)