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.
24 lines
268 B
24 lines
268 B
![]()
4 years ago
|
package solutions
|
||
|
|
||
|
func isInteresting(n int) bool {
|
||
|
s := 0
|
||
|
for n > 0 {
|
||
|
s += n % 10
|
||
|
n /= 10
|
||
|
}
|
||
|
if s%7 == 0 {
|
||
|
return true
|
||
|
}
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
func InterestingNumber(n int) int {
|
||
|
for n > 0 {
|
||
|
if isInteresting(n) == true {
|
||
|
return n
|
||
|
}
|
||
|
n++
|
||
|
}
|
||
|
return -1
|
||
|
}
|