diff --git a/src/ScientificCalculator.java b/src/ScientificCalculator.java new file mode 100644 index 0000000..eceddf7 --- /dev/null +++ b/src/ScientificCalculator.java @@ -0,0 +1,13 @@ +public class ScientificCalculator { + public long factorial(int n) { + if (n < 0) { + throw new IllegalArgumentException("Факториал не определён для отрицательных чисел"); + } + long result = 1; + for (int i = 2; i <= n; i++) { + result *= i; + } + return result; + } +} +