repo.or.cz
/
tinycc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
riscv: More insns, operands and arg slots
[tinycc.git]
/
examples
/
ex3.c
blob
5556a4bcd995ecc870054a86394cf6ece431bade
1
#include <tcclib.h>
2
3
int
fib
(
n
)
4
{
5
if
(
n
<=
2
)
6
return
1
;
7
else
8
return
fib
(
n
-
1
) +
fib
(
n
-
2
);
9
}
10
11
int
main
(
int
argc
,
char
**
argv
)
12
{
13
int
n
;
14
if
(
argc
<
2
) {
15
printf
(
"usage: fib n
\n
"
16
"Compute nth Fibonacci number
\n
"
);
17
return
1
;
18
}
19
20
n
=
atoi
(
argv
[
1
]);
21
printf
(
"fib(%d) = %d
\n
"
,
n
,
fib
(
n
,
2
));
22
return
0
;
23
}