Skip to content

EpicnessTwo/FizzBuzz

Repository files navigation

FizzBuzz

What is FizzBuzz?

FizzBuzz was originally a playground game between 2 or more children where they'd take it in turns to call out sequential numbers and replace multiples with words. The common version of this game would see people replacing multiples of 3 with the word "Fizz", multiples of 5 with "Buzz" and common multiples of both with "FizzBuzz".

What does this have to do with programming?

FizzBuzz became a standard interview question for applicants that showed knowledge of programming theory to test their practical or real world experience with a specific language. They'd be tasked with creating a program to simulate the game of FizzBuzz via an output.

Based off the response from the applicant, the interviewers will be able to gain some insight into how the applicant creates a working program to correctly simulate the outcome.

What are the rules?

As mentioned above, the game is rather simple to play. It however has to follow very strict rules.

  1. The program must count all numbers from 1 to 100
  2. The program must replace all multiples of 3 with the word "Fizz"
  3. The program must replace all multiples of 5 with the word "Buzz"
  4. The program must replace all multiples of 3 and 5 with the word "FizzBuzz"

An example of this is shown below:

1
2
Fizz
4
Buzz
Fizz
7
8
Fizz
Buzz
11
Fizz
13
14
FizzBuzz
16
17
...

Extension tasks and observations

The aim of this task is not to create the most efficient way of generating the correct outcome. It is however nice to try and not reuse the same code over and over again as this can show signs of messy code later on when things need to be adapted or added to.

Some extensions to this task are as follows

  1. Add multiples of 7 to be replaced with the word "Fuzz"
  2. Add multiples of 11 to be replaced with the word "Bizz"

About

Example Interview Question - FizzBuzz

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •