diff options
Diffstat (limited to 'c_compiler/test/in/fib_recusive.c')
-rw-r--r-- | c_compiler/test/in/fib_recusive.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/c_compiler/test/in/fib_recusive.c b/c_compiler/test/in/fib_recusive.c new file mode 100644 index 0000000..55abe06 --- /dev/null +++ b/c_compiler/test/in/fib_recusive.c @@ -0,0 +1,24 @@ +int Fibonacci(int n) +{ + if ( n == 0 ) + return 0; + else if ( n == 1 ) + return 1; + else + return ( Fibonacci(n-1) + Fibonacci(n-2) ); +} + +int main() +{ + int n, i = 0, c, res = 0; + + n = 10; + + for ( c = 1 ; c <= n ; c++ ) + { + res = Fibonacci(i); + i++; + } + + return res; +} |