← Back to If Statements
Question 249
Fizz Buzz Or Whizz
Fizz Buzz Or Whizz
Read one whole number and print its label: Fizz when it is divisible by 3, Buzz when by 5, Whizz when by 7, with the words joined in that order when several apply (15 gives FizzBuzz, 105 gives FizzBuzzWhizz), and the number itself when none apply. Use the remainder operator % for each divisibility test. Build the label in a string that starts empty, adding each word with its own if, then print either the label or the number. Input: one integer, no prompt. Output: one line.
Expected Output:
FizzBuzzWhizz= newline. The output ends with a newline — print one after the last line.
Hints4 available
Sign in to use hintsTopics:
If StatementsPractice Problems
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.