Skip to content
This repository

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

file 20 lines (19 sloc) 0.334 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
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);
    }
  }
}
Something went wrong with that request. Please try again.