Skip to content

Instantly share code, notes, and snippets.

@ohsawa0515
Created November 21, 2016 04:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ohsawa0515/a01f906097359b08e9c2819264f1da97 to your computer and use it in GitHub Desktop.
Save ohsawa0515/a01f906097359b08e9c2819264f1da97 to your computer and use it in GitHub Desktop.
Fizz Buzz golang version.
package main
import "fmt"
func main() {
max := 100
for i := 1; i <= max; i++ {
if i % 3 == 0 && i % 5 == 0 {
fmt.Println("Fizz Buzz")
} else if i % 3 == 0 {
fmt.Println("Fizz")
} else if i % 5 == 0 {
fmt.Println("Buzz")
} else {
fmt.Println(i)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment