import Foundation
func kelvin2Celsius(_ kelvin: Float) -> Float {
return kelvin - 273.15
}
func celsius2Kelvin(_ celsius: Float) -> Float {
return celsius + 273.15
}
func kelvin2Fahrenheit(_ kelvin: Float) -> Float {
return kelvin * (9.0 / 5.0) - 459.67
}
func fahrenheit2kelvin(_ fahrenheit: Float) -> Float {
return (fahrenheit + 459.67) * (5.0 / 9.0)
}
do {
let k = Float(77.4)
print("\(k)[K] \(kelvin2Celsius(k))[°C] \(kelvin2Fahrenheit(k))[°F]")
}
do {
let k = Float(195.1)
print("\(k)[K] \(kelvin2Celsius(k))[°C] \(kelvin2Fahrenheit(k))[°F]")
}
do {
let k = Float(310.15)
print("\(k)[K] \(kelvin2Celsius(k))[°C] \(kelvin2Fahrenheit(k))[°F]")
}
do {
let k = Float(373.1339)
print("\(k)[K] \(kelvin2Celsius(k))[°C] \(kelvin2Fahrenheit(k))[°F]")
}