Skip to content

Instantly share code, notes, and snippets.

@ibarroladt
Created July 2, 2013 03:48
Show Gist options
  • Save ibarroladt/5906655 to your computer and use it in GitHub Desktop.
Save ibarroladt/5906655 to your computer and use it in GitHub Desktop.
def times_table(rows)
def row(rows)
array = []
rows.times do |i|
array << i +1
end
array
end
def multiply(array, n)
array.length.times do |i|
array[i] = array[i]*n
end
array.join(" ")
end
rows.times do |i|
result = multiply(row(rows), i +1)
puts result
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment