## DEV Community

Ezekiel nwuguru

Posted on

Hey! it's day 6 of 10 days of coding challenge with I4G. Today's task was to write a code that executes fizz buzz multitreaded output.

Thought process:
Understanding of the problem: The first approach was to understand the task and the constraint attached. Here we writing a code that takes in an integer and prints fizz if the number is divisible by 3, Buzz if the number is divisible by 5, FizzBuzz if the number is divisible by both 3 and 5 or print out the number meets none of the above condition.
Solution: To achieve this, we need another that will be used to iterate through the given integer. For each iteration the conditions above are tested and the function that meet the condition is executed.

Algorithm:

1. initialize an integer count to 1
2. Set a while loop for each function with condition: count < n (the given integer)
3. If count is divisible by 3 but not by 5, call the printFizz function
4. If count is divisible by 5 but not by 3, call the printBuzz function
5. If count is divisible by both 3 and 5 call the printFizzBuzz function
6. If count is not divisible by both 3 and 5, call the printNumber function