# If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9.
# The sum of these multiples is 23.
# Find the sum of all the multiples of 3 or 5 below 1000.
def sumOfMultiplesLessThan(number)
sum = 0
(1..(number-1)).each { |x| sum += x if(x % 3 === 0 || x % 5 === 0) }
sum
end
puts sumOfMultiplesLessThan(1000)
# Output:
# 233168
#Spec file
require "problem1"
describe "Multiples of 3 and 5" do
describe "#sumOfMultiplesLessThan" do
it "finds sum of all multiples 3 and 5 below 10" do
sumOfMultiplesLessThan(10).should == 23
end
end
end