2024-08-20 19:55:35 +00:00
|
|
|
let mut count = 1
|
2024-03-25 04:16:55 +00:00
|
|
|
|
|
|
|
while count <= 15 {
|
2024-08-20 19:55:35 +00:00
|
|
|
let divides_by_3 = count % 3 == 0
|
|
|
|
let divides_by_5 = count % 5 == 0
|
2024-03-25 04:16:55 +00:00
|
|
|
|
2024-08-20 19:16:06 +00:00
|
|
|
let output = if divides_by_3 && divides_by_5 {
|
|
|
|
"fizzbuzz"
|
2024-08-10 08:45:30 +00:00
|
|
|
} else if divides_by_3 {
|
2024-08-20 19:16:06 +00:00
|
|
|
"fizz"
|
2024-03-25 04:16:55 +00:00
|
|
|
} else if divides_by_5 {
|
2024-08-20 19:16:06 +00:00
|
|
|
"buzz"
|
2024-05-20 21:15:05 +00:00
|
|
|
} else {
|
2024-10-05 10:42:19 +00:00
|
|
|
string(count)
|
2024-08-20 19:55:35 +00:00
|
|
|
}
|
2024-05-20 21:15:05 +00:00
|
|
|
|
2024-08-10 08:45:30 +00:00
|
|
|
write_line(output)
|
|
|
|
|
2024-03-25 04:16:55 +00:00
|
|
|
count += 1
|
|
|
|
}
|