Prints out the following for a contiguous range of numbers:
- the number
fizzfor numbers that are multiples of3buzzfor numbers that are multiples of5fizzbuzzfor numbers that are multiples of15- if the number contains a
threeoutput the textlucky, overriding any existing behaviour - report at the end of the program showing how many times each
wordwas substituted
There is also a Java version and a Clojure version
Running the program over a range from 1-20 one should get the following output:
[1 2 lucky 4 buzz fizz 7 8 fizz buzz 11 fizz lucky 14 fizzbuzz 16 17 fizz 19 buzz]
{
"buzz": 3,
"fizz": 4,
"fizzbuzz": 1,
"integer": 10,
"lucky": 2
}
go run main.go
go test