repo.or.cz
/
tinycc
/
miki.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
tests: Minor adjustments selecting which tests are run on each platform.
[tinycc/miki.git]
/
win32
/
examples
/
fib.c
blob
7c4ee24ec370196e0d0059fa8ee41725c659cb4d
1
#include <stdio.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
));
22
return
0
;
23
}