From 7ce2d39b93a8babba49e926bde1ba8cf52d738f0 Mon Sep 17 00:00:00 2001 From: Kaputchino <61330453+Kaputchino@users.noreply.github.com> Date: Wed, 25 May 2022 19:02:29 +0200 Subject: [PATCH] sort correctly the added functions --- ZSharp/ZS.h | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/ZSharp/ZS.h b/ZSharp/ZS.h index c5956e8..46a5ccd 100644 --- a/ZSharp/ZS.h +++ b/ZSharp/ZS.h @@ -151,27 +151,7 @@ func Comb(n, r) { return Perm(n ,r) / Fac(r) } -//return the number of permutation -func Perm(n, r) -{ - if n < 0 - { - ZS.System.PrintLine("n muss be superior or equal to 0") - return -1 - } - if r < 0 - { - ZS.System.PrintLine("r muss be superior or equal to 0") - return -1 - } - if r > n - { - ZS.System.PrintLine("r muss be inferor or equal to n") - return -1 - } - return Fac(n) / Fac(n - r) -} //return the factorial of a number func Fac(x) @@ -201,5 +181,28 @@ func TaylorExp(x) } return sum } + +//return the number of permutation + +func Perm(n, r) +{ + if n < 0 + { + ZS.System.PrintLine("n muss be superior or equal to 0") + return -1 + } + if r < 0 + { + ZS.System.PrintLine("r muss be superior or equal to 0") + return -1 + } + if r > n + { + ZS.System.PrintLine("r muss be inferor or equal to n") + return -1 + } + return Fac(n) / Fac(n - r) +} + )" ;