Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
34
Task/General-FizzBuzz/Go/general-fizzbuzz.go
Normal file
34
Task/General-FizzBuzz/Go/general-fizzbuzz.go
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
const numbers = 3
|
||||
|
||||
func main() {
|
||||
|
||||
//using the provided data
|
||||
max := 20
|
||||
words := map[int]string{
|
||||
3: "Fizz",
|
||||
5: "Buzz",
|
||||
7: "Baxx",
|
||||
}
|
||||
keys := []int{3, 5, 7}
|
||||
divisible := false
|
||||
for i := 1; i <= max; i++ {
|
||||
for _, n := range keys {
|
||||
if i % n == 0 {
|
||||
fmt.Print(words[n])
|
||||
divisible = true
|
||||
}
|
||||
}
|
||||
if !divisible {
|
||||
fmt.Print(i)
|
||||
}
|
||||
fmt.Println()
|
||||
divisible = false
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue