32 lines
367 B
C
32 lines
367 B
C
#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;
|
|
|
|
} |