Created
January 21, 2011 22:54
-
-
Save rramsden/790597 to your computer and use it in GitHub Desktop.
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
require 'rainbow' | |
puts "enter a number" | |
mod = Integer(gets) | |
(0..mod-1).each do |i| | |
row = "" | |
(0..mod-1).each do |j| | |
if ((j * i) % mod) == 1 | |
row += " #{(j * i) % mod}".ljust(3).color(:red) | |
else | |
row += " #{(j * i) % mod}".ljust(3).color((i*j) % 255, 255, 255) | |
end | |
end | |
puts row | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment