package recursive;
public class JavaApplication24 {
public int f(int sayi) {
if (sayi <= 2) {
return 1;
} else {
return f(sayi - 1) + f(sayi - 2);
}
}
public static void main(String[] args) {
JavaApplication24 a = new JavaApplication24();
int t = a.f(40);
System.out.println(t);
}
}
Hiç yorum yok:
Yorum Gönder