Skip to content

Instantly share code, notes, and snippets.

@sukhchander
Created April 4, 2014 13:26
Show Gist options
  • Save sukhchander/9974676 to your computer and use it in GitHub Desktop.
Save sukhchander/9974676 to your computer and use it in GitHub Desktop.
def multiples(max)
(1...max).select {|i| i % 3 == 0 || i % 5 == 0 }.reduce(:+)
end
puts multiples(1000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment