Converting degrees
You will be given two lines of text as input. On the first line, you will receive a number followed by two letters, the first representing the unit that the number is currently in, the second representing the unit it needs to be converted to.
You must output the given input value, in the unit specified. It must be followed by the unit letter. You may round to a whole number, or to a few decimal places. Challenge Input
Also support these units:
c for Celsius f for Fahrenheit k for Kelvin
See here for a wikipedia page with temperature conversion formulas. See here for a random web link about converting between degrees and radians.
Apparently Emacs defines float-pi
to be defined as pi! Very cool!
float-pi
3.141592653589793
(defun 273/rad-to-deg (x)
"Let's convert radians to degrees"
(* x (/ 180 float-pi)))
273/rad-to-deg
(defun 273/deg-to-rad (x)
"convert degrees to radians"
(* x (/ float-pi 180)))
273/deg-to-rad