public class Fakultaet { public static long fakIter(int n) { long result = 1; while (n > 1) { result *= n; n--; } return result; } public static long fakIter2(int n) { long result = 1; int i = 1; while (i <= n) { result *= i; i++; } return result; } public static long fakRek(int n) { // Abbruchbedingung: if (n == 0) return 1; // Rekursiver Aufruf: return n * fakRek(n-1); } public static long fakRek2(int n) { return fakRek2Helper(1, n); } public static long fakRek2Helper(int i, int n) { if (i == n) return n; return i * fakRek2Helper(i+1, n); } }