Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
calculate times table in base 12
begin
base = ARGV.length > 0 ? ARGV[0].to_i : 12
rescue
puts "usuage:
ruby #{__FILE__} {number}
(number = 12 by default)"
end
puts "times table in base #{base}:"
(base + 1).times {|x|
(base + 1).times {|y|
#print "#{(x*y).to_s(base)} "
printf "%3s ",(x*y).to_s(base)
}
print "\n"
}
nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment