Skip to content

Instantly share code, notes, and snippets.

@shihgianlee
Last active December 17, 2015 05:58
Show Gist options
  • Save shihgianlee/5561628 to your computer and use it in GitHub Desktop.
Save shihgianlee/5561628 to your computer and use it in GitHub Desktop.
def print_right_half_triangle(num_of_rows)
count = 0
last_count = 0
for i in 1..num_of_rows
for j in 1..i
last_count = count + j
print last_count.to_s + " "
end
puts "\n"
count = last_count
end
end
print_right_half_triangle(6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment