factorial function

int factorial(
  1. int n
)

Faktorial hisoblash funksiyasi

Implementation

int factorial(int n) {
  if (n < 0) throw ArgumentError('Manfiy son uchun faktorial mavjud emas');
  return n == 0 ? 1 : n * factorial(n - 1);
}