Exercise · Variables and types · lesson 10 of 10
Exercise: Fahrenheit
Write a function func toFahrenheit(c float64) float64 that converts a temperature from degrees Celsius to degrees Fahrenheit by the formula F = C × 1.8 + 32.
toFahrenheit(100)→212toFahrenheit(-40)→-40toFahrenheit(36.6)→97.88
Constraints: the temperature is not below absolute zero (−273.15 °C), and the result is compared with the expected one to within 1e-9, that is, 0.000000001.
Do not add extra imports unless the task says so explicitly.
Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.