public class Fibonacci {
public static void main(String[] args) {
Fibonacci f=new Fibonacci();
System.out.println("8. fibonacci sayisi: "+f.fibo(8));
}
private int fibo(int i) {
if(i<=1)
return i;
return fibo(i-2)+fibo(i-1);
}
}
11/03/2011
public class Fibonacci {
public static void main(String[] args) {
Fibonacci f=new Fibonacci();
System.out.println("8. fibonacci sayisi: "+f.fibo(8));
}
private int fibo(int i) {
if(i<=1)
return i;
return fibo(i-2)+fibo(i-1);
}
}