From 6eea987b6f2b0448b5f870476f9d7e6657ef0730 Mon Sep 17 00:00:00 2001 From: David Fernandez Date: Mon, 25 Mar 2024 13:39:05 -0400 Subject: [PATCH] Solves #5560 Write a Scala program to convert temperature from celsius to kelvin --- ...onvert_temperature_from_celsius_to_kelvin.scala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 program/program/convert-temperature-from-celsius-to-kelvin/convert_temperature_from_celsius_to_kelvin.scala diff --git a/program/program/convert-temperature-from-celsius-to-kelvin/convert_temperature_from_celsius_to_kelvin.scala b/program/program/convert-temperature-from-celsius-to-kelvin/convert_temperature_from_celsius_to_kelvin.scala new file mode 100644 index 000000000..8a67eaea8 --- /dev/null +++ b/program/program/convert-temperature-from-celsius-to-kelvin/convert_temperature_from_celsius_to_kelvin.scala @@ -0,0 +1,14 @@ +object CelsiusToKelvinConverter { + def celsiusToKelvin(celsius: Double): Double = { + val kelvin = celsius + 273.15 + kelvin + } + + def main(args: Array[String]): Unit = { + val celsius = -40.0 + val kelvin = celsiusToKelvin(celsius) + println(s"Input (C): $celsius") + println(s"Output (K): $kelvin") + } +} +