diff options
Diffstat (limited to 'tests/langbench/fib.l')
-rw-r--r-- | tests/langbench/fib.l | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/langbench/fib.l b/tests/langbench/fib.l new file mode 100644 index 0000000..dfb1e52 --- /dev/null +++ b/tests/langbench/fib.l @@ -0,0 +1,20 @@ + +int +fib(int n) +{ + if (n < 2) { + return (n); + } else { + return (fib(n - 1) + fib(n - 2)); + } +} + +void +main() +{ + int i; + + for (i = 0; i <= 30; ++i) { + printf("n=%d => %d\n", i, fib(i)); + } +} |