mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
12 lines
251 B
Dart
12 lines
251 B
Dart
// An expensive but pretty
|
|
// recursive implementation
|
|
int fibonacci(int n) {
|
|
if (n <= 1) return n;
|
|
return fibonacci(n - 1) + fibonacci(n - 2);
|
|
}
|
|
|
|
void main() {
|
|
print("Fibonacci sequence:");
|
|
for (var n = 0; n < 10; n++) print(fibonacci(n));
|
|
}
|