File size: 212 Bytes
c574d3a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
class RecursiveFib{
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= 5;
System.out.println(fib(n));
}
}
|