Browse Source

refactoring: factorial

remotes/origin/Ulrich
Ulriche Nguefack 11 months ago
parent
commit
c94eefc912
  1. 7
      src/main/c/Calculator/calculator.c

7
src/main/c/Calculator/calculator.c

@ -121,6 +121,13 @@ double getDoubleInput(const char *message) {
scanf("%lf", &input);
return input;
}
double factorial(double num) {
if (num == 0) {
return 1;
} else {
return num * factorial(num - 1);
}
}
int getIntInput(const char *message) {
int input;

Loading…
Cancel
Save