commit 9c7421782de7405dddbc4b2dd9d381dd320ec79c parent 476999291c7c2cbe482afaac72fd37f705aab56f Author: Christos Margiolis <christos@margiolis.net> Date: Fri, 20 Dec 2019 23:10:18 +0200 fixed combinations Diffstat:
M | assignment-1.4-functions/menu/src/menu-full.c | | | 2 | +- |
M | assignment-1.4-functions/menu/src/menu-libs.c | | | 2 | +- |
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/assignment-1.4-functions/menu/src/menu-full.c b/assignment-1.4-functions/menu/src/menu-full.c @@ -106,5 +106,5 @@ int factorial(int num) int combinations(int a, int b) { - return factorial(b) / (factorial (a) * factorial(abs(b-a))); + return factorial(a) / (factorial (b) * factorial(a - b)); } \ No newline at end of file diff --git a/assignment-1.4-functions/menu/src/menu-libs.c b/assignment-1.4-functions/menu/src/menu-libs.c @@ -85,5 +85,5 @@ int factorial(int a) int combinations(int a, int b) { - return factorial(b) / (factorial (a) * factorial(abs(b-a))); + return factorial(a) / (factorial (b) * factorial(a - b)); } \ No newline at end of file