From c73c9093cc96bd8e8dfc0c1fca2e29a5271eb648 Mon Sep 17 00:00:00 2001 From: Timofey Date: Thu, 15 Jan 2026 15:15:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=BA=D0=BB=D0=B0=D1=81=D1=81=20ScientificCalculator=20=D1=81?= =?UTF-8?q?=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D0=BE=D0=BC=20=D0=B2=D1=8B?= =?UTF-8?q?=D1=87=D0=B8=D1=81=D0=BB=D0=B5=D0=BD=D0=B8=D1=8F=20=D1=84=D0=B0?= =?UTF-8?q?=D0=BA=D1=82=D0=BE=D1=80=D0=B8=D0=B0=D0=BB=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ScientificCalculator.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/ScientificCalculator.java 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; + } +} +