Question: plz use java Fizz Buzz is a game that is played as follows: Players sit in a circle The player who goes first says the
Fizz Buzz is a game that is played as follows: Players sit in a circle The player who goes first says the number "1" Each subsequent player says the number that comes after the number the previous player said If the number is divisible by 3, the player must say "Fizz" instead of the number If the number is divisible by 5, the player must say "Buzz" instead of the number If the number is divisible by both 3 and 5, the player must say "FizzBuzz" If the number is not divisible by 3 and not divisible by 5, the player must say the number itself For example, the sequence should go "1', "2", "Fizz", "4", "Buzz", "Fizz', "7", "8", "Fizz", "Buzz", "11", "Fizz", "13", "14", "FizzBuzz', etc. Assume we have already defined a variable of type int called num with the following line of code: int num- ???; // 'num' can have any int value TASK: Print "Fizz", "Buzz", or "FizzBuzz" depending on num's value. Sample Input: 15 Sample Output: FizzBuzz
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
