print("Enter purchase value:")
purchase=gets.chomp()
print ("Enter Sales Value:")
sell=gets.chomp()
puts(sell-purchase)
That's the code When I said 400 and 500, The result I want is 900 It's 400500 I think it's because the input is processed as a string What should I do to see the output value of 900?
ruby
print("Enter purchase value:")
purchase=gets.chomp().to_i
print ("Enter Sales Value:")
sell=gets.chomp().to_i
puts(sell-purchase)
You can do it.
© 2024 OneMinuteCode. All rights reserved.