The image looks like this.
while str = STDIN.gets
break if str.chomp == "exit"#Returns the string with the line feed code removed from the end of the string
n=str.to_i#A method that returns a string as an integer
puts n
for x in 0..n-1
(n-x-1).times{printf(" ")}
for y in 1..2*x+1
printf("*")
end
puts "\n"
end
end
October 20, 2020
Recommended Posts