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.2.0.3 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.2.0.2 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.2.0.1 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.2.0.0 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.55 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.54 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.53 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.52 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.51 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.50 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.49 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.48 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.47 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.46 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.45 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.44 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.43 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.42 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.41 tracks/go/exercises/sum-of-multiples/example.go
trackler-2.1.0.40 tracks/go/exercises/sum-of-multiples/example.go