Sha256: 1368059522c28d376a2d13e0979f360149bb7415c4127ce8a14421aa6210bb65

Contents?: true

Size: 343 Bytes

Versions: 92

Compression:

Stored size: 343 Bytes

Contents

package summultiples

const testVersion = 2

// SumMultiples returns the sum of the multiples of the given divisors
// up to, but not including, the given limit.
func SumMultiples(limit int, divisors ...int) (sum int) {
	for i := 1; i < limit; i++ {
		for _, d := range divisors {
			if i%d == 0 {
				sum += i
				break
			}
		}
	}
	return
}

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
trackler-2.1.0.39 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.38 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.37 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.36 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.34 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.33 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.32 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.31 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.30 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.29 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.28 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.27 tracks/go/exercises/sum-of-multiples/example.go