From the course: Go Essentials: Concurrency, Connectivity, and High-Performance Apps

Unlock the full course today

Join today to access over 24,600 courses taught by industry experts.

Solution: FizzBuzz

Solution: FizzBuzz

(exciting music) - [Instructor] Let's see my solution. So we have function main and here we are doing a loop between I equal one, I less than or equal to 20, I plus plus. And first we check if it's divisible by both three and five and if it's so, then we are printing fizz buzz. Otherwise, if it's divisible by three, we are printing fizz. Otherwise, if it's divisible by five, we are printing buzz. And finally we print the number. Let's run. And we see that we get the numbers. So one, two, instead of three, we have fizz, instead of four, we have buzz, et cetera, et cetera. And in 15, which divides by both three and five, we have fizz buzz.

Contents