Skip to content

Instantly share code, notes, and snippets.

@gayapedro
Created February 19, 2019 22:17
Show Gist options
  • Select an option

  • Save gayapedro/2189d07485787609a112ddaaeff353c5 to your computer and use it in GitHub Desktop.

Select an option

Save gayapedro/2189d07485787609a112ddaaeff353c5 to your computer and use it in GitHub Desktop.
public class Fibonacci
{
public static int calcfib;
public static void main(String[] args){
calcfib = fib(5);
System.out.println(calcfib);
}
public static int fib(int n){
if(n<=1)return 1;
return fib(n-1) + fib(n-2);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment