Last active
December 25, 2015 14:48
-
-
Save Bjacksonshorts/6993273 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
puts "what is your temperature (write degree as C or F)" | |
degree = gets.chomp; | |
if degree.include?("F") | |
degreeC = degree.split("") - ["F"] | |
newDegree = degreeC.join.to_i * 9/5 +32 | |
puts "the Temperature is " + newDegree.to_s + " degrees Celsius" | |
end | |
if degree.include?("C") | |
degreeC = degree.split("") - ["C"] | |
newDegree = (degreeC.join.to_i - 32) * 5/9 | |
puts "the Temperature is " + newDegree.to_s + " degrees Fahrenheit" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment