Last active
August 29, 2015 14:12
-
-
Save gingeleski/25d3a86603736ef57a4f to your computer and use it in GitHub Desktop.
Finds the sum of all multiples of 3 or 5 below 1000.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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