This file contains hidden or 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
| ##### Fahrenheit to Celsius | |
| def convert(f) | |
| c = ((f.to_i-32)*(5.0/9.0)) | |
| c = (c * 10).round * 0.1 | |
| end | |
| puts "Convert Fahrenheit to Celsius." | |
| print "Input the Fahrenheit: " | |
| f = gets |
This file contains hidden or 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 ftoc(degree) | |
| answer = ((degree -32) * 5.0 / 9.0).round(1) | |
| puts answer | |
| end | |
| def ctof(degree) | |
| answer = (degree * 9.0 / 5.0 + 32).round(1) | |
| puts answer | |
| end |
This file contains hidden or 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 ctof(g) | |
| #return ((g*9)/5)+32 | |
| return ((((g*9)/5)+32)*10).round / 10.0 | |
| end | |
| ctof(100.43) |
This file contains hidden or 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 | |