mirror of https://github.com/01-edu/public.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
212 B
20 lines
212 B
5 years ago
|
package correct
|
||
5 years ago
|
|
||
|
func isInteresting(n int) bool {
|
||
|
s := 0
|
||
|
for n > 0 {
|
||
|
s += n % 10
|
||
|
n /= 10
|
||
|
}
|
||
5 years ago
|
return s%7 == 0
|
||
5 years ago
|
}
|
||
|
|
||
|
func InterestingNumber(n int) int {
|
||
5 years ago
|
for {
|
||
|
if isInteresting(n) {
|
||
5 years ago
|
return n
|
||
|
}
|
||
|
n++
|
||
|
}
|
||
|
}
|