diff --git a/src/fakultaet/fakultaet.c b/src/fakultaet/fakultaet.c index 63a600f..93273f6 100644 --- a/src/fakultaet/fakultaet.c +++ b/src/fakultaet/fakultaet.c @@ -1,6 +1,13 @@ #include int fakultaet(int n) { + if (n == 0 || n == 1) + return 1; + int result = 1; + for (int i = 2; i <= n; i++) { + result *= i; + } + return result; } \ No newline at end of file