Skip to content · ⁨본문 바로가기⁩

FizzBuzz

FizzBuzz

The classic. Walk the numbers 1 to n and, for each, decide what string to add to a list:

  • divisible by both 3 and 5 → FizzBuzz
  • divisible by 3 → Fizz
  • divisible by 5 → Buzz
  • otherwise → the number itself, as a string

Check the "both" case first, or a multiple of 15 will be caught by the 3 test alone.

Log in or create account · ⁨로그인 또는 계정 만들기⁩

IGCSE, A-Level & AP