mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nprimo
529e5c8fdb
|
5 months ago | |
---|---|---|
.. | ||
README.md | 5 months ago | |
main.go | 5 months ago |
README.md
gcd
Instructions
Write a function that takes two uint
representing two strictly positive integers and returns their greatest common divisor.
If any of the input numbers is 0, the function should return 0.
Expected function
func Gcd(a, b uint) uint {
}
Usage
Here is a possible program to test your function:
package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(piscine.Gcd(42, 10))
fmt.Println(piscine.Gcd(42, 12))
fmt.Println(piscine.Gcd(14, 77))
fmt.Println(piscine.Gcd(17, 3))
}
And its output :
$ go run .
2
6
7
1
$