Skip to content

Instantly share code, notes, and snippets.

@ydawant
Created March 19, 2013 02:45
Show Gist options
  • Save ydawant/5193341 to your computer and use it in GitHub Desktop.
Save ydawant/5193341 to your computer and use it in GitHub Desktop.
Times Table - no spaces
def times_table(rows)
array = Array.new(rows) { Array.new(rows) }
y=0
array.each_with_index do |x, index|
until y == rows
x[y] = index+1
x[y] *= (y + 1)
y += 1
end
y=0
puts "#{x}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment