Last active
August 29, 2015 13:56
-
-
Save dtothefp/9202480 to your computer and use it in GitHub Desktop.
Mario Pyramid
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
puts "Enter the pyramid height" | |
input = gets.chomp.to_i | |
while input < 1 || input > 69 | |
puts "Please enter a number between 1 and 69" | |
input = gets.chomp.to_i | |
end | |
puts "Your input is #{input}" | |
i = 1 | |
while i <= input do | |
hashes = i + 1 | |
spaces = input - i | |
spaces.times do | |
print " " | |
end | |
hashes.times do | |
print "#" | |
end | |
puts "" | |
i += 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment