Skip to content

Instantly share code, notes, and snippets.

@frvi
Created April 9, 2014 14:21
Show Gist options
  • Save frvi/10276139 to your computer and use it in GitHub Desktop.
Save frvi/10276139 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"strconv"
)
func main() {
for i := 1; i <= 100; i++ {
fizzbuzz(i)
}
}
func fizzbuzz(i int) {
msg := ""
if i%3 == 0 {
msg += "Fizz"
}
if i%5 == 0 {
msg += "Buzz"
}
if msg == "" {
msg = strconv.Itoa(i)
}
fmt.Println(msg)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment