Converting Celsius to Fahrenheit

Report a typo

Given an input integer representing a temperature in Celsius, print the equivalent temperature in Fahrenheit as an integer value. To convert from Celsius to Fahrenheit, multiply the Celsius value by 9, divide by 5, and add 32.

Sample Input 1:

0

Sample Output 1:

32

Sample Input 2:

100

Sample Output 2:

212
Write a program in Kotlin
import kotlin.math.round

fun main() {
// Read temperature in Celsius as a double
val celsius = readLine()!!.toDouble()

// TODO: Convert Celsius to Fahrenheit
val fahrenheit = 0.0

// Print temperature in Fahrenheit rounded to nearest integer
println(round(fahrenheit).toInt())
}

Create a free account to access the full topic