Sum Numbers
Use a while loop to add up all the numbers from 1 to 10, then print the result.
Expected output:
text
Sum: 55
Hints:
- You'll need two mutable variables: one for the counter and one for the total
- Start with
let mut sum = 0;andlet mut i = 1; - Add
itosumeach time through the loop - Print the sum after the loop using
println!("Sum: {}", sum);
rust
fn main() {
}