BUT2/DEV/DEV1.1_suite/TP_Recursivité/Q1_Fibonacci.c~
2023-10-23 13:23:36 +02:00

22 lines
284 B
C

#include <stdio.h>
#include <stdlib.h>
int fibonacci(int rang){
if (rang==0){
return 0;
}
else{
if (rang==1){
return 1;
}
else{
return fibonacci(rang-1) + fibonacci(rang-2);
}
}
}
int main(void){
printf("%d\n",fibonacci(15));
return 0;
}