Skip to content

Commit 43ed563

Browse files
committed
[ex] add example C file
1 parent ad6ef7d commit 43ed563

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

hello.c

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <stdio.h>
2+
3+
int fibonacci(int i) {
4+
if (i <= 1) {
5+
return 1;
6+
}
7+
return fibonacci(i-1) + fibonacci(i-2);
8+
}
9+
10+
int main()
11+
{
12+
int i;
13+
i = 0;
14+
while (i <= 10) {
15+
printf("fibonacci(%2d) = %d\n", i, fibonacci(i));
16+
i = i + 1;
17+
}
18+
return 0;
19+
}

0 commit comments

Comments
 (0)