Following program shows you how to take a number as input and tells its positive or negative.
In this program we get number from user, and if the number is less than zero it prints negative, and if the number is grater than zero it prints positive
puts "Please enter a number:" input = Integer(gets.chomp) if input < 0 puts "Given number is -ve" else puts "Given number is +ve" end
Please enter a number: 2 Given number is +ve
Please enter a number: -3 Given number is -ve