Skip to content

Instantly share code, notes, and snippets.

@johana-star
Created May 26, 2011 05:27
Show Gist options
  • Save johana-star/992604 to your computer and use it in GitHub Desktop.
Save johana-star/992604 to your computer and use it in GitHub Desktop.
Euler Project Problem #001
# Solution to Project Euler's first problem
# http://projecteuler.net/index.php?section=problems&id=1
# Sum all numbers divisible by 3 or 5 below 1000.
sum = 0
1.upto(999) do |n|
if (n % 3 == 0 || n % 5 == 0) then
sum = sum + n
end
end
p sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment