Skip to content

Commit

Permalink
sort correctly the added functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kaputchino committed May 25, 2022
1 parent 7d7033c commit 7ce2d39
Showing 1 changed file with 23 additions and 20 deletions.
43 changes: 23 additions & 20 deletions ZSharp/ZS.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
)"
;

0 comments on commit 7ce2d39

Please sign in to comment.