Skip to content

Instantly share code, notes, and snippets.

@sanatgersappa
Created January 1, 2015 10:52
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 sanatgersappa/8c1f1bf68e6bdfb111ee to your computer and use it in GitHub Desktop.
Save sanatgersappa/8c1f1bf68e6bdfb111ee to your computer and use it in GitHub Desktop.
package main
import "fmt"
func main() {
for i := 1; i <= 100; i++ {
if i%15 == 0 { //divisible by 5 and 3
fmt.Println("FizzBuzz")
} else if i%5 == 0 { //divisible by 5
fmt.Println("Buzz")
} else if i%3 == 0 { //divisible by 3
fmt.Println("Fizz")
} else { //not divisible by either 5 or 3
fmt.Printf("%d\n", i)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment