From 711bb63cf4225c0121f950401550604f0285182e Mon Sep 17 00:00:00 2001 From: Justin Trausch Date: Wed, 7 Feb 2024 20:34:06 +0100 Subject: [PATCH] Fakultaet Double Funktion implementiert --- src/fakultaet.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/fakultaet.c b/src/fakultaet.c index e057620..46d9f0f 100644 --- a/src/fakultaet.c +++ b/src/fakultaet.c @@ -12,6 +12,14 @@ int berechneFakultaetInt(int zahl) { } } -double berechneFakultaetDouble(double a, double b) { - return 0; +int berechneFakultaetDouble(double zahl) { + if (zahl == 0 || zahl == 1) { + return 1; + } else { + double fakultaet = 1; + for (double i = 2; i <= zahl; ++i) { + fakultaet *= i; + } + return fakultaet; + } }