Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- num = 1000
- sum = 0
- (1...num).each{|i|
- if i % 3 == 0
- sum += i
- elsif i % 5 == 0
- sum += i
- end
- }
- puts sum
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement