public class Fib {
public static int compteur;
public static int fib(int n) {
compteur++;
System.out.println("fib("+n+")");
if (n==0) return 1;
if (n==1) return 1;
return fib(n-1)+fib(n-2);
}
public static void main(String []a) {
try {
compteur = 0;
int n = Integer.parseInt(a[0]);
int v = fib(n);
System.out.println("Fibonnacci("+n+")="+v);
System.out.println("Nombre d'appels = "+compteur);
} catch(Exception e) {
}
}
}