jkaihsu
3/7/2013 - 8:19 AM

Write a method print_triangle which takes at its input an integer representing the number of rows to print, and prints out a right triangle

Write a method print_triangle which takes at its input an integer representing the number of rows to print, and prints out a right triangle consisting of * characters, one line per row.

For example, print_triangle(5) should print out:

def print_triangle(rows)
  for j in 1..rows do
     for i in 1..j do
         print "*" * 1
     end
     puts
    end
end