Last active
August 29, 2015 14:11
-
-
Save kayluhb/edc8eef1a12caf495a6a to your computer and use it in GitHub Desktop.
Multiplication tables in Ruby
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
multipliers = (1..9) | |
multipliers.each do |x| | |
print multipliers.map {|y| | |
s = y * x | |
"#{s < 10 ? ' ' : ''}#{s}" | |
}.join(' ') | |
print "\n" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment