6 lines
165 B
Ruby
6 lines
165 B
Ruby
# Solution for the sum of all number multiple of 3 or 5 between 1 and 999
|
|
|
|
sum = (1..999).select {|n| n % 5 == 0 || n % 3 == 0}
|
|
result = sum.inject(:+)
|
|
print result
|