INFO505 Programmation C
Loading...
Searching...
No Matches
TP1
fibo.c
1
#include <stdio.h>
2
3
int
fibo(
int
n) {
4
if
(n <= 1) {
5
return
1;
6
}
7
int
f1 = fibo(n-1);
8
int
f2 = fibo(n-2);
9
int
res = f1 + f2;
10
return
res;
11
}
12
13
int
main() {
14
for
(
int
i = 0; i < 10; i++) {
15
printf(
"fibo %i : %i\n"
, i, fibo(i));
16
}
17
return
0;
18
}
Generated on Wed Nov 8 2023 11:06:18 for INFO505 Programmation C by
1.9.8