fibonacci en utilisant la récursivité
int fib (int n) {
if (n < 2)
return 1;
return fib(n-1) + fib(n-2);
}
Itchy Iguana
int fib (int n) {
if (n < 2)
return 1;
return fib(n-1) + fib(n-2);
}
def fib (n):
if n == 0 or n ==1:
return n
else:
return fib(n-2) + fib(n-1)
#n = int(input("please enter a number "))
n=10
for index,num in enumerate(range(n+1)):
print(f"F{index} :", fib(num))