Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: e757b883ee
Fetching contributors…

Cannot retrieve contributors at this time

21 lines (19 sloc) 0.334 kb
class fibonacciFormula implements formula {
// P(n) = P(n-1) + P(n-2)
// P(0) = 0, P(1) = 1
fibonacciFormula(this.name);
calculate() {
value = _fib(parameters);
}
final name;
int value;
int parameters;
_fib(x) {
if (x<=1) {
return x;
}
else {
return _fib(x-1) + _fib(x-2);
}
}
}
Jump to Line
Something went wrong with that request. Please try again.