Last active
March 5, 2019 13:03
-
-
Save LordRahl90/6c60d16fdfacfae130af3ec9863325a2 to your computer and use it in GitHub Desktop.
Smallest Multiple Problem. Project Eular #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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