Skip to content

Commit

Permalink
Solves codinasion-archive#5560 Write a Scala program to convert tempe…
Browse files Browse the repository at this point in the history
…rature from celsius to kelvin
  • Loading branch information
David Fernandez authored and David Fernandez committed Mar 25, 2024
1 parent e3295e0 commit 6eea987
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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")
}
}

0 comments on commit 6eea987

Please sign in to comment.