blob: 4bb7f58c9e89023818f8722122807c3fd7294e7b (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
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;
}
}
|