package kata func sum(array []int) int { result := 0 for _, v := range array { result += v } return result } func Multiple3And5(number int) int { m := make([]int, 0) for i := 1; i < number; i++ { if i%3 == 0 || i%5 == 0 { m = append(m, i) } } return sum(m) }
- package kata
func Multiple3And5(number int) int {- func sum(array []int) int {
- result := 0
- for _, v := range array {
- result += v
- }
- return result
- }
- func Multiple3And5(number int) int {
- m := make([]int, 0)
- for i := 1; i < number; i++ {
- if i%3 == 0 || i%5 == 0 {
- m = append(m, i)
- }
- }
- return sum(m)
- }