Skip to content

Instantly share code, notes, and snippets.

@seemcat
Created January 9, 2019 08:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seemcat/42f02123e144b495d5a2512e17cb48cf to your computer and use it in GitHub Desktop.
Save seemcat/42f02123e144b495d5a2512e17cb48cf to your computer and use it in GitHub Desktop.
c0d3 solved in Go
func solution8(num1, num2 int) int {
var list []int
var biggerNum int
if num1 > num2 {
biggerNum = num1
} else {
biggerNum = num2
}
for i := 1; i < biggerNum; i++ {
if (num1 % i == 0 && num2 % i == 0) {
list = append(list, i)
}
}
max := list[0]
for _, value := range list {
if value > max {
max = value
}
}
return max
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment