Created
May 17, 2012 20:25
-
-
Save JustinAiken/2721399 to your computer and use it in GitHub Desktop.
euler 1
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
def problem001 | |
total = 0 | |
for i in 1..9 | |
if i%3 == 0 | |
puts "#{i} is divisible by 3" | |
total = total + i | |
puts total | |
end | |
if i%5 == 0 | |
puts "#{i} is divisible by 5" | |
total = total + i | |
puts total | |
end | |
end | |
return total | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment