Skip to content

Instantly share code, notes, and snippets.

@gingeleski
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gingeleski/25d3a86603736ef57a4f to your computer and use it in GitHub Desktop.
Save gingeleski/25d3a86603736ef57a4f to your computer and use it in GitHub Desktop.
Finds the sum of all multiples of 3 or 5 below 1000.
# Finds the sum of all multiples of 3 or 5 below 1000
sum = 0
i = 1
while i <= 1000
sum += i if i % 3 == 0 || i % 5 == 0
i += 1
end
sum
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment