mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-11 19:41:43 +08:00
25 lines
311 B
Go
Executable File
25 lines
311 B
Go
Executable File
package main
|
|
|
|
import "fmt"
|
|
|
|
const (
|
|
FIZZ = 3
|
|
BUZZ = 5
|
|
FIZZBUZZ = 15
|
|
)
|
|
|
|
func main() {
|
|
for i := 0; i <= 100; i++ {
|
|
switch {
|
|
case i%FIZZBUZZ == 0:
|
|
fmt.Println("FizzBuzz")
|
|
case i%FIZZ == 0:
|
|
fmt.Println("Fizz")
|
|
case i%BUZZ == 0:
|
|
fmt.Println("Buzz")
|
|
default:
|
|
fmt.Println(i)
|
|
}
|
|
}
|
|
}
|