Answers for "go fizzbuzz"

Go
-1

go fizzbuzz

import "fmt"

func main() {

    for i := 1; i <= 100; i++ {
        s := ""
        if i%3==0 {
            s = "Fizz"
        }
        if i%5==0 {
            s = "Buzz"
        }
        if s == "" {
            s = fmt.Sprintf("%d", i)
        }
	    fmt.Printf("%s\n", s)        
    }
}
Posted by: Guest on May-03-2021

Browse Popular Code Answers by Language