cminus/data/test12.c

16 lines
277 B
C
Raw Permalink Normal View History

2023-04-10 11:17:11 -04:00
int fib(int i) {
if (i == 0) return 1;
if (i == 1) return 1;
return fib(i-1) + fib(i-2);
}
void main() {
int i;
i = 0;
println("This program prints the first 12 numbers of the Fibonacci sequence.");
while (i < 12) {
println(fib(i));
i = i + 1;
}
}