From ec6a0686f9ed7b44726d0011535a80bcda875e11 Mon Sep 17 00:00:00 2001 From: Justin Trausch Date: Wed, 7 Feb 2024 20:31:43 +0100 Subject: [PATCH] Fakultaet Int Funktion implementiert --- src/fakultaet.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/fakultaet.c b/src/fakultaet.c index 2e81e16..e057620 100644 --- a/src/fakultaet.c +++ b/src/fakultaet.c @@ -1,8 +1,17 @@ #include "fakultaet.h" int berechneFakultaetInt(int zahl) { - return 0; + if (zahl == 0 || zahl == 1) { + return 1; + } else { + int fakultaet = 1; + for (int i = 2; i <= zahl; ++i) { + fakultaet *= i; + } + return fakultaet; + } } + double berechneFakultaetDouble(double a, double b) { return 0; }