Rust#rust#algorithms
FizzBuzz
The interview classic, implemented idiomatically in Rust.
1fn main() {
2 for n in 1..=100 {
3 match (n % 3, n % 5) {
4 (0, 0) => println!("FizzBuzz"),
5 (0, _) => println!("Fizz"),
6 (_, 0) => println!("Buzz"),
7 _ => println!("{n}"),
8 }
9 }
10}
11
README.md
FizzBuzz in Rust
Uses a tuple match on the remainders — no nested if/else needed.