dietlibc support
[tinycc.git] / ex3.c
blob6f6f6305e1cd4aa67b27e77d8d0220fa0d3da7c7
1 #include <tcclib.h>
3 int fib(n)
5 if (n <= 2)
6 return 1;
7 else
8 return fib(n-1) + fib(n-2);
11 int main(int argc, char **argv)
13 int n;
14 if (argc < 2) {
15 printf("usage: fib n\n"
16 "Compute nth Fibonacci number\n");
17 return 1;
20 n = atoi(argv[1]);
21 printf("fib(%d) = %d\n", n, fib(n, 2));
22 return 0;