Skip to content

Instantly share code, notes, and snippets.

@kenrett
Created February 23, 2013 06:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenrett/5018695 to your computer and use it in GitHub Desktop.
Save kenrett/5018695 to your computer and use it in GitHub Desktop.
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