basics · beginner · ~15 min

FizzBuzz word

Order if/else branches so the most specific case wins.

Challenge

Implement const char *fizzbuzz_word(int n) returning "FizzBuzz" if n is divisible by 15, "Fizz" if by 3, "Buzz" if by 5, otherwise an empty string "".

Starter code

const char *fizzbuzz_word(int n) {
    /* TODO */
    return "";
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.