Temperature conversion: Difference between revisions

From Rosetta Code
Content added Content deleted
(added draft task)
 
(draft template)
Line 1: Line 1:
{{draft task}}

There are quite a number of temperature scales. For this task we will concentrate on 4 of the perhaps best-known ones: [http://en.wikipedia.org/wiki/Kelvin Kelvin], [http://en.wikipedia.org/wiki/Degree_Celsius Celcius], [http://en.wikipedia.org/wiki/Fahrenheit Fahrenheit] and [http://en.wikipedia.org/wiki/Degree_Rankine Rankine].
There are quite a number of temperature scales. For this task we will concentrate on 4 of the perhaps best-known ones: [http://en.wikipedia.org/wiki/Kelvin Kelvin], [http://en.wikipedia.org/wiki/Degree_Celsius Celcius], [http://en.wikipedia.org/wiki/Fahrenheit Fahrenheit] and [http://en.wikipedia.org/wiki/Degree_Rankine Rankine].



Revision as of 18:38, 12 February 2013

Temperature conversion is a draft programming task. It is not yet considered ready to be promoted as a complete task, for reasons that should be found in its talk page.

There are quite a number of temperature scales. For this task we will concentrate on 4 of the perhaps best-known ones: Kelvin, Celcius, Fahrenheit and Rankine.


The Celcius and Kelvin scales have the same magnitude, but different null points.

0 degrees Celcius corresponds to 273.15 kelvin.

0 kelvin is absolute zero.


The Fahrenheit and Rankine scales also have the same magnitude, but different null points.

0 degrees Fahrenheit corresponds to 459.67 degrees Rankine.

0 degrees Rankine is absolute zero.


The Celcius/Kelvin and Fahrenheit/Rankine scales have a ratio of 5 : 9.


Write code that accepts a value of kelvin, converts it to values on the three other scales and prints the result. For instance:

K  21.00

C  -252.15

F  -421.87

R  37.80