diff --git a/solutions/buzzinga.go b/solutions/buzzinga.go new file mode 100644 index 00000000..aab76830 --- /dev/null +++ b/solutions/buzzinga.go @@ -0,0 +1,21 @@ +package solution + +import "fmt" + +func BuzZinga(n int32) { + var i int32 = 0 + if n == 0 { + fmt.Println("Buzzinga") + } + for i = 1; i <= n; i++ { + if i%3 == 0 && i%5 == 0 { + fmt.Println("Buzzinga") + } else if i%3 == 0 { + fmt.Println("Buz") + } else if i%5 == 0 { + fmt.Println("zinga") + } else { + fmt.Println("*") + } + } +} diff --git a/tests/buzzinga_test/main.go b/tests/buzzinga_test/main.go new file mode 100644 index 00000000..7a98b843 --- /dev/null +++ b/tests/buzzinga_test/main.go @@ -0,0 +1,18 @@ +package main + +import ( + student "student" + + "github.com/01-edu/go-tests/lib/challenge" + "github.com/01-edu/go-tests/solutions" +) + +func main() { + challenge.Function("BuzZinga", student.BuzZinga, solutions.BuzZinga, 20) + challenge.Function("BuzZinga", student.BuzZinga, solutions.BuzZinga, 15) + challenge.Function("BuzZinga", student.BuzZinga, solutions.BuzZinga, -125) + challenge.Function("BuzZinga", student.BuzZinga, solutions.BuzZinga, 10) + challenge.Function("BuzZinga", student.BuzZinga, solutions.BuzZinga, 5) + challenge.Function("BuzZinga", student.BuzZinga, solutions.BuzZinga, 4) + challenge.Function("BuzZinga", student.BuzZinga, solutions.BuzZinga, -9) +}