Skip to content

Instantly share code, notes, and snippets.

@Bjacksonshorts
Last active December 25, 2015 14:48
Show Gist options
  • Save Bjacksonshorts/6993273 to your computer and use it in GitHub Desktop.
Save Bjacksonshorts/6993273 to your computer and use it in GitHub Desktop.
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