DEV/DEV1.1/TP14/fibo.c

32 lines
367 B
C
Raw Normal View History

2022-12-14 15:29:55 +01:00
#include <stdio.h>
#include <stdlib.h>
int fibonacci(int n)
{
if (n <= 1)
{
return 1;
}else
{
return(fibonacci(n-1)+fibonacci(n-2));
}
}
void fibonacci2(int n)
{
if (n!=0)
{
fibonacci2(n-1);
printf("%d\n",fibonacci(n));
}
}
int main(int argc, char const *argv[])
{
/*printf("%d\n", fibonacci(5));*/
fibonacci2(4);
printf("%d",!0);
return 0;
}