Browse Source

refactoring: added function comments

remotes/origin/fakultaet
Hendrik Sitzmann 11 months ago
parent
commit
33def303b4
  1. 2
      src/fakultaet/fakultaet.c

2
src/fakultaet/fakultaet.c

@ -1,9 +1,11 @@
#include <stdio.h> #include <stdio.h>
int fakultaet(int n) { int fakultaet(int n) {
// Checking if the input is either zero or one
if (n == 0 || n == 1) if (n == 0 || n == 1)
return 1; return 1;
// The result multiplies with i and i increases every turn until the loop ends
int result = 1; int result = 1;
for (int i = 2; i <= n; i++) { for (int i = 2; i <= n; i++) {
result *= i; result *= i;

Loading…
Cancel
Save