Skip to content

Instantly share code, notes, and snippets.

@kfatehi
Created October 8, 2012 05:08
Show Gist options
  • Save kfatehi/3850821 to your computer and use it in GitHub Desktop.
Save kfatehi/3850821 to your computer and use it in GitHub Desktop.
➜ triangle_lulz ruby triangle.rb
Enter base size
10
Triangle of base size 10:
*
**
***
****
*****
******
*******
********
*********
**********
***********
************
➜ triangle_lulz
puts "Enter base size "
base = gets.chomp.to_i
puts "Triangle of base size #{base}:"
[*0..base].each do |col|
print "*\n"
[*0..col].each do
print "*"
end
end
print "*\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment