diff --git a/src/main/c/Calculator/calculator.c b/src/main/c/Calculator/calculator.c index 99894eb..6f0a91d 100644 --- a/src/main/c/Calculator/calculator.c +++ b/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); +} \ No newline at end of file