Skip to content

Instantly share code, notes, and snippets.

@Twisol
Forked from thex00/gist:513313
Created August 7, 2010 23:30
Show Gist options
  • Save Twisol/513320 to your computer and use it in GitHub Desktop.
Save Twisol/513320 to your computer and use it in GitHub Desktop.
class Integer
def factor_of? (other)
other % self == 0
end
end
1.upto(100) do |x|
bt = (3.factor_of?(x) ? "" :"not ") + "divisible by 3"
bf = (5.factor_of?(x) ? "" : "not ") + "divisible by 5"
puts "The value #{x} is #{bt} and is #{bf}"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment