To find the maximum of three numbers in Rust, you can use the `std::cmp::max` function.
In this example,
a
, b
, and c
with the numbers to compare.fn main() {
let a = 5;
let b = 8;
let c = 3;
let max = std::cmp::max(std::cmp::max(a, b), c);
println!("Maximum of three numbers is: {}", max);
}
Maximum of three numbers is: 8
In this tutorial, we learned How to find the Maximum of Three Numbers in Rust language with well detailed examples.