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