Created
March 6, 2020 17:01
-
-
Save NoobSolver/bd18dec63e4e78811edea18f3099c7cb to your computer and use it in GitHub Desktop.
Fibonacci sequence
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
var i = 20; | |
print('fibonacci($i) = ${fibonacci(i)}'); | |
} | |
int fibonacci(int n) { | |
return n < 2 ? n : (fibonacci(n - 1) + fibonacci(n - 2)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment