1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-08 06:32:28 +08:00

doc: add go playground demo

This commit is contained in:
dudaodong
2023-05-19 11:42:17 +08:00
parent 78aa679670
commit 259dbce85e
13 changed files with 48 additions and 29 deletions

View File

@@ -55,7 +55,7 @@ func Factorial(x uint) uint {
}
// Percent calculate the percentage of value to total.
// Play: https://go.dev/play/p/QQM9B13coSP
// Play: https://go.dev/play/p/s0NdFCtwuyd
func Percent(val, total float64, n int) float64 {
if total == 0 {
return float64(0)
@@ -258,7 +258,7 @@ func IsPrime(n int) bool {
}
// GCD return greatest common divisor (GCD) of integers.
// Play: todo
// Play: https://go.dev/play/p/CiEceLSoAKB
func GCD[T constraints.Integer](integers ...T) T {
result := integers[0]
@@ -283,7 +283,7 @@ func gcd[T constraints.Integer](a, b T) T {
}
// LCM return Least Common Multiple (LCM) of integers.
// Play: todo
// Play: https://go.dev/play/p/EjcZxfY7G_g
func LCM[T constraints.Integer](integers ...T) T {
result := integers[0]