Skip to content

Instantly share code, notes, and snippets.

@cdnsteve
Created April 12, 2015 18:53
Show Gist options
  • Save cdnsteve/003ad45ba64fb8e6f38e to your computer and use it in GitHub Desktop.
Save cdnsteve/003ad45ba64fb8e6f38e to your computer and use it in GitHub Desktop.
Fizz Buzz example using Go Lang
// Copyright 2015 Steven Leggett. All rights reserved.
package main
import "fmt"
func main() {
const (
x string = "Go Lang Fizz Buzz"
v string = "1.0.0"
)
fmt.Println(x, v)
i := 1
for i <= 100 {
if i%3 == 0 && i%5 == 0 {
fmt.Println(i, "FizzBuzz")
} else if i%3 == 0 {
fmt.Println(i, "Fizz")
} else if i%5 == 0 {
fmt.Println(i, "Buzz")
} else {
fmt.Println(i)
}
i = i + 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment