def times_table(n) (1..n).each do |row_num| line = "" (1..n).each{ |col_num| line += "#{row_num * col_num}\t"} puts line end end times_table(5)