Fizz Buzz in Every LanguagePublished on 01 November 2018 (Updated: 02 May 2020)
In this article, we’re tackling the Fizz Buzz problem, its requirements, and how to test a solution.
Fizz Buzz is a typical interview question which tests the developers knowledge of flow control and operators. The goal of the problem is to output the numbers 1 through 100 but with special cases for various intervals–traditionally 3 (Fizz) and 5 (Buzz).
For the purposes of this repository, the following rules apply:
Write a program that prints the numbers 1 to 100. However, for multiples of three, print “Fizz” instead of the number. Meanwhile, for multiples of five, print “Buzz” instead of the number. For numbers which are multiples of both three and five, print “FizzBuzz”
To be even more specific, please output each value on its own line. The output should look something like:
1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz
The program should then be saved in a file called fizz buzz using the proper naming conventions of your choice language.
Verify that the actual output matches the expected output. See the requirements section for an example of the expected output.
- Fizz Buzz in Befunge on 30 August 2020 by Stuart Irwin
- Fizz Buzz in C on 05 October 2020 by Shubhra Gupta
- Fizz Buzz in Java on 06 November 2018 by Stuart Irwin
- Fizz Buzz in Kotlin on 28 October 2020 by Stuart Irwin
- Fizz Buzz in Lisp on 18 October 2019 by Stuart Irwin
- Fizz Buzz in PowerShell on 11 December 2018 by Devin Leaman
- Fizz Buzz in Python on 15 December 2018 by samdoj
- Fizz Buzz in Rust on 11 December 2021 by Bodo Schönfeld
- Fizz Buzz in Swift on 24 November 2018 by Marty Hernandez Avedon