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
correct libtcc1 link order
[tinycc.git]
/
ex3.c
blob
6f6f6305e1cd4aa67b27e77d8d0220fa0d3da7c7
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
}