mirror of
https://github.com/cubixle/codekata-golang.git
synced 2026-04-30 19:38:45 +01:00
refactor: rename dirctory
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
n := 20
|
||||
for {
|
||||
if IsDivisibleFor1to20(n) {
|
||||
fmt.Println("evenly divisible by all of the numbers from 1 to 20:", n)
|
||||
return
|
||||
}
|
||||
n++
|
||||
}
|
||||
}
|
||||
|
||||
func IsDivisibleFor1to20(n int) bool {
|
||||
for i := 1; i <= 20; i++ {
|
||||
if n%i != 0 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
Reference in New Issue
Block a user