From 55065b6b998339d795910a84d6f58b3e1c081c0b Mon Sep 17 00:00:00 2001 From: Hendrik Sitzmann Date: Thu, 8 Feb 2024 00:59:27 +0100 Subject: [PATCH] added fakultaet.c function --- src/fakultaet/fakultaet.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/fakultaet/fakultaet.c b/src/fakultaet/fakultaet.c index 63a600f..93273f6 100644 --- a/src/fakultaet/fakultaet.c +++ b/src/fakultaet/fakultaet.c @@ -1,6 +1,13 @@ #include int fakultaet(int n) { + if (n == 0 || n == 1) + return 1; + int result = 1; + for (int i = 2; i <= n; i++) { + result *= i; + } + return result; } \ No newline at end of file