From the course: Rust Essential Training

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Challenge: Convert temperature

Challenge: Convert temperature - Rust Tutorial

From the course: Rust Essential Training

Start my 1-month free trial

Challenge: Convert temperature

- - [Narrator] It's time for another programming challenge. This time, I need your help to convert temperatures from Celsius to Fahrenheit. You see, my wife is Canadian and I am from the US. She always tells me the temperature in Celsius but my brain works in Fahrenheit. I think a program to translate will help us communicate better. Your goal for this challenge is to write a Rust function named Celsius to Fahrenheit. It should have an input parameter to accept a temperature value in Celsius. And then return the corresponding temperature in Fahrenheit. The equation to convert from Celsius to Fahrenheit involves multiplying the temperature in Celsius by 1.8 and then adding 32 degrees to that. I've provided you this code in the exercise files to use as a starting point. It declares a Celsius temperature on line two and then uses the yet to be written Celsius to Fahrenheit function then convert that temperature to Fahrenheit…

Contents