From the course: Rust Essential Training

Unlock the full course today

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

Challenge: Max, min, mean

Challenge: Max, min, mean - Rust Tutorial

From the course: Rust Essential Training

Start my 1-month free trial

Challenge: Max, min, mean

- [Narrator] It's time for another challenge. To practice using loops and conditional expressions. I'll give you an array full of numbers. And your goal will be to determine the maximum value in that array. The minimum value in the array. And the mean or average of all the values. As a reminder you can calculate the mean by adding together all the values in the array. And then dividing by the number of elements in the array. In this code from the exercise files, I've declared the array of numbers for you to use on line two. As well as mutable variables on lines three through five to hold the max, min, and mean values. Notice that I have not initialized these three variables to any specific value. I've just defined their data types. Your job is to replace the comment on line seven with your code to calculate the max, min, and mean values for the array. And assign those results to their respective variables. After…

Contents