Browse Source

permutation and combination called

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

11
src/main/c/Calculator/calculator.c

@ -250,3 +250,14 @@ double cosine(double angle) {
double tangent(double angle) {
return tan(angle * M_PI / 180.0);
}
double permutation(int n, int r) {
int 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);
}
Loading…
Cancel
Save