Created
February 23, 2013 06:23
-
-
Save kenrett/5018695 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) | |
if rows == 0 | |
return false | |
end | |
array = [] | |
counter = 1 | |
while counter <= rows | |
1.upto(rows) do |i| | |
array << i*counter | |
end | |
counter += 1 | |
end | |
puts array.join(' ') | |
end | |
times_table(5) | |
times_table(10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment