Rust FizzBuzz Loop Programming

# Introduction In this lab, we learn about the `while` keyword, which is used to create a loop that continues executing as long as a specified condition is true. To illustrate its usage, we write a program in Rust called FizzBuzz. The program uses a `while` loop to iterate through numbers from 1 to 100. Inside the loop, it checks if the current number is divisible by 3 and 5 (i.e., a multiple of 15) and prints "fizzbuzz" in such cases. If the number is only divisible by 3, it prints "fizz", and if it is only divisible by 5, it prints "buzz". For all other numbers, it simply prints the number itself. The loop continues until the counter variable reaches 101, incrementing it after printing each number or label. > **Note:** If the lab does not specify a file name, you can use any file name you want. For example, you can use `main.rs`, compile and run it with `rustc main.rs && ./main`.

|60 : 00

Click the virtual machine below to start practicing