题解 | #牛牛的二三七整除#
牛牛的二三七整除
http://www.nowcoder.com/practice/b2cf0b791245436f8f0591ae9f4c664f
package main
import (
"fmt"
)
func main () {
var (
a int
flag bool = false
)
fmt.Scanf("%d", &a)
arr := []int{2, 3, 7}
for i, _ := range arr {
if a%arr[i] == 0 {
flag = true
fmt.Printf("%d ", arr[i])
}
}
if !flag {
fmt.Println("n")
}
}