|
@ -128,6 +128,17 @@ double factorial(double num) { |
|
|
return num * factorial(num - 1); |
|
|
return num * factorial(num - 1); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
double permutation(int n, int r) { |
|
|
|
|
|
double result = 1; |
|
|
|
|
|
for (int i = 0; i < r; i++) { |
|
|
|
|
|
result *= (n - i); |
|
|
|
|
|
} |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
double combination(int n, int r) { |
|
|
|
|
|
return permutation(n, r) / factorial(r); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
int getIntInput(const char *message) { |
|
|
int getIntInput(const char *message) { |
|
|
int input; |
|
|
int input; |
|
|