Rust Fundamentals · 15 XP
Functions and return values
Functions are declared with fn. Every parameter needs a type, and so does the
return value, written after ->.
In Rust, the last expression in a function body is its return value. Note the
missing semicolon: adding ; turns an expression into a statement that returns
() instead.
fn double(x: i32) -> i32 {
x * 2
}
Your task
Write a public function celsius_to_fahrenheit that takes an f64 and returns
the temperature in Fahrenheit as an f64. The formula is c * 9.0 / 5.0 + 32.0.