go-examples/fizzbuzz/main.go
2017-07-07 14:29:36 +02:00

20 lines
284 B
Go

package main
import "fmt"
func main() {
for i := 1; i <= 100; i++ {
mod3 := i % 3
mod5 := i % 5
if mod3+mod5 == 0 {
fmt.Println("FizzBuzz")
} else if mod3 == 0 {
fmt.Println("Fizz")
} else if mod5 == 0 {
fmt.Println("Buzz")
} else {
fmt.Println(i)
}
}
}