fakultät-Methode einfacher gestaltet, wegen Diagramm
parent
1aa15e069c
commit
4f3113e678
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue