Skip to content

Instantly share code, notes, and snippets.

@Polyrhythm
Created March 16, 2012 17:53
Show Gist options
  • Save Polyrhythm/2051464 to your computer and use it in GitHub Desktop.
Save Polyrhythm/2051464 to your computer and use it in GitHub Desktop.
Ruby C to F converter
print "Hello. Please enter a celsius value: "
celsius = gets
fahrenheit = (celsius.to_i * 9 / 5) + 32
print "The fahrenheit equivalent is: "
print fahrenheit
puts "."
# REFACTORED METHOD (denser, but less readable)
# print "Hello. Please enter a celsius value: "
# print "The fahrenheit equivalent is: " gets.to_i * 9/5 + 32, ".\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment