J
Ja Bo
I can't figure out how to round my answer from this short code that I
wrote. I was trying to use both 'format' and 'round' with no luck...
Thank you all in advance!!!
Code:
puts "Fahrenheit to Centigrade Conversion"
puts "-----------------------------------"
puts "Input a temperature in Fahrenheit: "
STDOUT.flush
ftemp = gets.chomp.to_f
ctemp = ( (ftemp - 32) / 1.8 )
format( "%.2f", ctemp )
puts ""
puts ftemp.to_s + " F is " + ctemp.to_s + " C."
puts ""
wrote. I was trying to use both 'format' and 'round' with no luck...
Thank you all in advance!!!
Code:
puts "Fahrenheit to Centigrade Conversion"
puts "-----------------------------------"
puts "Input a temperature in Fahrenheit: "
STDOUT.flush
ftemp = gets.chomp.to_f
ctemp = ( (ftemp - 32) / 1.8 )
format( "%.2f", ctemp )
puts ""
puts ftemp.to_s + " F is " + ctemp.to_s + " C."
puts ""