Skip to content

Instantly share code, notes, and snippets.

@jamesmichiemo
Created May 4, 2014 21:14
Show Gist options
  • Select an option

  • Save jamesmichiemo/d03464293e9d3728edc6 to your computer and use it in GitHub Desktop.

Select an option

Save jamesmichiemo/d03464293e9d3728edc6 to your computer and use it in GitHub Desktop.
Project Euler: problem 1 http://projecteuler.net/problem=1
sum = 0
(0...1000).each do |i|
sum += i if (i%3 == 0 || i%5 == 0)
end
puts "The sum total of all the multiples of 3 or 5 is #{sum}."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment