2022-02-20

How to get the puts output to read actual numbers instead of (x,y)

So my written program works, but when I get the output it says, point x,y lies at "insert end". What do I need to change to get the "x,y" to give the digits that are inputted?

puts "Enter the x and y coordinate points:"
x = gets.chomp.to_f
y = gets.chomp.to_f

if x > 0 and y > 0
  puts "point #{"x,y"} lies in the First quadrant"
elsif x < 0 and y > 0
  puts "point #{"x,y"} lies in the Second quadrant"
elsif x < 0 and y < 0
  puts "point #{"x,y"} lies in the Third quadrant"
elsif x > 0 and y < 0
  puts "point #{"x,y"} lies in the Fourth quadrant"
elsif x == 0 and y > 0
  puts "point #{"x,y"} lies at the positive y axis"
elsif x == 0 and y < 0
  puts "point #{"x,y"} lies at the negative y axis"
elsif y == 0 and x < 0
  puts "point #{"x,y"} lies at the negative x axis"
elsif y == 0 and x > 0
  puts "point #{"x,y"} lies at the positive x axis"
else
  puts "point #{"x,y"} lies at the origin"
end    


from Recent Questions - Stack Overflow https://ift.tt/lJQhP8o
https://ift.tt/FXHnecp

No comments:

Post a Comment