23 lines
477 B
Rust
23 lines
477 B
Rust
fn main() {
|
|
let buzzes = [(3, "Fizz"), (5, "Buzz")];
|
|
|
|
for i in 1..101 {
|
|
let output = (0..buzzes.len()).fold(String::new(), |string, j| {
|
|
if i % buzzes[j].0 == 0 {
|
|
string + buzzes[j].1
|
|
} else {
|
|
string
|
|
}
|
|
});
|
|
|
|
println!(
|
|
"{}",
|
|
if output.len() == 0 {
|
|
i.to_string()
|
|
} else {
|
|
output
|
|
}
|
|
);
|
|
}
|
|
}
|