b236db0ff6
Change-Id: Icb1c4ee11aca319647e4e33214fe8b4c3b8134ae Reviewed-on: https://dart-review.googlesource.com/c/81762 Auto-Submit: Peter von der Ahé <ahe@google.com> Reviewed-by: Jens Johansen <jensj@google.com> Commit-Queue: Peter von der Ahé <ahe@google.com>
15 lines
405 B
Plaintext
15 lines
405 B
Plaintext
library;
|
|
import self as self;
|
|
import "dart:core" as core;
|
|
|
|
static method fibonacci(core::int n) → core::int {
|
|
if(n.{core::num::<}(2))
|
|
return n;
|
|
return self::fibonacci(n.{core::num::-}(1)).{core::num::+}(self::fibonacci(n.{core::num::-}(2)));
|
|
}
|
|
static method main() → dynamic {
|
|
for (core::int i = 0; i.{core::num::<}(20); i = i.{core::num::+}(1)) {
|
|
core::print(self::fibonacci(i));
|
|
}
|
|
}
|