riscv: More insns, operands and arg slots
[tinycc.git] / examples / ex3.c
blob5556a4bcd995ecc870054a86394cf6ece431bade
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;