Been programming only 3 days. Sorry for the extreme newbie question but
I am working on a study drill where I am suppose to ask the user for a
money amount and give back 10% of it. So far It looks like it works but
I am having problems when printing out the result. This is what I have
currently.
print “Return amount set at 10%\n”
prompt user for total amount
print "Enter total amount: "
amount = gets.chomp.to_f
amt_return = amount * 0.10
puts “Your return is: #{amt_return}”
When I type in for example 103.4 the return is 10.3400000002
In the exercises I haven’t got to the point where it teaches this so
I was wondering how can I get it to only show 10.34 and not all the
zeros after it?
Thank you