factorial method

Decimal factorial(
  1. int n
)

Implementation

Decimal factorial(int n) {
  Decimal result = Decimal.one;
  for (int i = 2; i <= n; i++) {
    result *= Decimal.fromInt(i);
  }
  return result;
}