5 lines
143 B
Ruby
5 lines
143 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}
|
|
sum.inject(:+)
|