Can you write an a simpler Rust fizzbuzz program than I have? Use my output or the spec:
Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.
to write your program. I want to see if it's possible to write an even simpler program.
fn main() {
for i in 1..102 {
match i {
i if (i % 15 == 0) => { println!("{:?}", "FizzBuzz") },
i if (i % 3 == 0) => { println!("{:?}", "Fizz") },
i if (i % 5 == 0) => { println!("{:?}", "Buzz") },
_ => { println!("{:?}", i) },
}
}
}
102
, instead of101
? This seem to print to101
, beyond 100 \$\endgroup\$