Created
July 2, 2013 03:48
-
-
Save ibarroladt/5906655 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
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