Last active
December 16, 2015 15:09
-
-
Save aoimakino/5454019 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Conversor celsius a fahrenheit# | |
def celafah | |
print "Temperatura en °C" | |
cel = gets.chomp.to_f | |
fah = ((cel * 9) / 5) + 32 | |
return fah | |
end | |
celafah |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fahacel | |
print "Temperatura en °F" | |
fah = gets.chomp.to_f | |
cel = (fah-32) * (5/9.0) | |
return cel | |
end | |
fahacel |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Me gusto la forma de resolver lo del redondeo...
Como lograste que redondee a 1 dígito, no entiendo la lógica... en que momento hace lo de 1 digito:
cel = gets.chomp.to_f
fah = ((cel * 9) / 5) + 32
En la segunda no funciona el redondeo:
Temperatura en °F213
100.555555555556