#!/usr/bin/ruby # f2c: 5*(F - 32)/9 # c2f: 9*C/5 + 32 degrees = ARGV[0] current = degrees[0, degrees.length - 1].to_f fc = degrees[-1,1] if (fc == "f") converted = 5*(current-32)/9 puts "#{current}°F = #{converted}°C" else if (fc == "c") puts "dd" else puts "ERROR: #{fc} is not a valid unit of measure." end end