Skip to content

Instantly share code, notes, and snippets.

@LordRahl90
Last active March 5, 2019 13:03
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 LordRahl90/6c60d16fdfacfae130af3ec9863325a2 to your computer and use it in GitHub Desktop.
Save LordRahl90/6c60d16fdfacfae130af3ec9863325a2 to your computer and use it in GitHub Desktop.
Smallest Multiple Problem. Project Eular #5
package main
import "fmt"
func solution() int {
var min int
num := 21
found := false
for !found {
var clean bool
//divisor declaration
for i := 1; i <= 20; i++ {
if num%i != 0 {
clean = false
break
} else {
clean = true
}
}
if clean {
found = true
min = num
}
num++
}
return min
}
func main() {
min := solution()
fmt.Println("Min is: ", min)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment