Skip to content

Instantly share code, notes, and snippets.

Created October 8, 2016 20:51
Show Gist options
  • Save anonymous/20e9721ff125c7e2a595e5d3e61abf90 to your computer and use it in GitHub Desktop.
Save anonymous/20e9721ff125c7e2a595e5d3e61abf90 to your computer and use it in GitHub Desktop.
fatdragon-dart
// fib seq
// 1 1 2 3 5 8 13 21 ...
num fibonacci(num n) {
if (n == 1 || n == 2) {
return 1;
} else {
return fibonacci(n-1) + fibonacci(n-2);
}
}
void main() {
for (num i = 1; i <= 10; i++) {
print(fibonacci(i));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment