FizzBuzz is a nearly trivial programming exercise, sometimes used in job interviews to weed out candidates who say they can program but really can't.
- http://imranontech.com/2007/01/24/using-fizzbuzz-to-find-developers-who-grok-coding/ by Imran Ghory
- http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html by Jeff Atwood
The requirements are simple:
Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz".
In my fizzbuz-c project I present multiple (86 at last count) C solutions.
NOTE : This is not intended as a collaborative project. It is my own personal playground. A few people have submitted pull requests for languages I haven't covered, which I certainly appreciate, but I won't be accepting them. If you're interested in collaborating on something similar, see Rosetta Code. Bug reports are quite welcome.
Here I present multiple implementations, one in each language. The current set of languages (90 of them) is:
- Algol 68
- BASIC (bwBASIC)
- Bourne shell
- Common Lisp
- Emacs Lisp
- Erlang (using escript)
- FORTRAN 66
- FORTRAN 77
- Fortran 90
- gcc error messages
- Nim (formerly Nimrod)
- Octave (should be compatible with Matlab)
- Perl 5
- Perl 6
- Python 2
- Python 3
- Rc (Plan 9 shell)
- Thomson Shell
- Visual Basic .NET
- x86/x86_64/SPARC assembly
Many of these are inspired by http://99-bottles-of-beer.net/.
cat are simply the standard Unix/Linux utilities, not real
scripting languages. The
cat implementation in particular is an ugly
cheat, depending on the existence of the
curl is a URL transfer utility, not a programming language.
fizzbuzz.cat, depends on the existence
expected-output.txt, but on this
than in the current directory. It also requires an Internet connection.
verify script executes each program and confirms that its
output is correct. It works on my system, x86_64 Ubuntu 16.10,
with required packages installed as documented in each source file.
fizzbuzz.b is not tested with an actual B compiler; see that file
fizzbuzz.sh6 failed due to a problem with the external
I'm in touch with the maintainer to (I hope) get a fix for this. See
sh6-bug subdirectory for details. (For now I've worked around
this problem by using
osh rather than
osh is an enhanced
sh6 that has
goto as a built-in command.)
The Whitespace web page is currently down, so I'm using the Perl implementation from here. I'll update the "comments" in the source file later (that's difficult to do, since I have to preserve existing whitespace).
I'm keeping an informal list of languages I intend to add in TODO.md.
Do not take this too seriously.