diff --git a/PR1_Pflichtuebung6/src/ueb6/Rechner.java b/PR1_Pflichtuebung6/src/ueb6/Rechner.java index 7143428..b8928ee 100644 --- a/PR1_Pflichtuebung6/src/ueb6/Rechner.java +++ b/PR1_Pflichtuebung6/src/ueb6/Rechner.java @@ -230,11 +230,11 @@ public class Rechner { if (n < 0) { throw new IllegalArgumentException("Zahl darf nicht negativ sein."); } else if (n == 0) - return 0; - else if (n == 1 || n == 2) - return n; + return 1; else { - return fakultaet(n-1) * n; + return n * fakultaet(n-1); + } + } } \ No newline at end of file