Skip to main content

Practice · 3 of 4

FizzBuzz, but rigorous

CHALLENGE
Difficulty: beginner+25 XP

Implement static string FizzBuzz(int n) — for 1..n append lines: multiples of 3 → Fizz, of 5 → Buzz, of both → FizzBuzz, else the number. Each line ends with \n (including the last). n = 0 returns "".

Back to lesson: Practice: Flow under pressure