FizzBuzz Problem

Problem Overview

  • Given an integer N, print one line per i from 1 to N: Fizz, Buzz, FizzBuzz, or i based on divisibility by 3 and 5.
  • Input: integer inputNum (N); Output: line-separated values for i=1..N in ascending order.
  • Constraint: 0 < N < 2*10^6 for this problem.
  • Classic coding interview problem and interview question used to assess basic logic and I/O skills.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: