Skip to content

FizzBuzz with 4 and 6

FizzBuzz with 4 and 6

A FizzBuzz with a trap in it.

Test for both first, with n % 4 == 0 and n % 6 == 0. Multiplying the two numbers, n % 24 == 0, looks like a shortcut but misses 12: a number can divide by 4 and by 6 without dividing by 24.

Log in or create account

IGCSE, A-Level & AP