1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-08 22:52:29 +08:00

doc: add document for GCD and LCM function

This commit is contained in:
dudaodong
2023-05-06 11:28:38 +08:00
parent 654ba15aaf
commit e2aeb8ec07
5 changed files with 210 additions and 8 deletions

View File

@@ -281,3 +281,39 @@ func ExampleIsPrime() {
// false
// true
}
func ExampleGCD() {
result1 := GCD(1, 1)
result2 := GCD(1, -1)
result3 := GCD(-1, 1)
result4 := GCD(-1, -1)
result5 := GCD(3, 6, 9)
fmt.Println(result1)
fmt.Println(result2)
fmt.Println(result3)
fmt.Println(result4)
fmt.Println(result5)
// Output:
// 1
// 1
// -1
// -1
// 3
}
func ExampleLCM() {
result1 := LCM(1, 1)
result2 := LCM(1, 2)
result3 := LCM(3, 6, 9)
fmt.Println(result1)
fmt.Println(result2)
fmt.Println(result3)
// Output:
// 1
// 2
// 18
}