Browse Source

added fakultaet.c function

remotes/origin/fakultaet
Hendrik Sitzmann 11 months ago
parent
commit
55065b6b99
  1. 7
      src/fakultaet/fakultaet.c

7
src/fakultaet/fakultaet.c

@ -1,6 +1,13 @@
#include <stdio.h> #include <stdio.h>
int fakultaet(int n) { 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;
} }
Loading…
Cancel
Save