History

fib fix (grischka)

bellard committed 21 years ago

Commit 6144d431 parent c897c521 file · +23 −23Browse files

Unified · Split

win32/examples/fib.c+23−23
@@ -1,23 +1,23 @@
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, 2));
22− return 0;
23−}
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+}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t