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/](Using FizzBuzz to Find Developers who Grok Coding) by Imran Ghory
- [http://www.codinghorror.com/blog/2007/02/why-cant-programmers-program.html](Why Can't Programmers.. Program?) 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 (37 at last count) C solutions.
Here I present multiple implementations, one in each language. The current set of languages (51 of them) is:
- Algol 68
- BASIC (bwBASIC)
- Bourne shell
- Erlang (using escript)
- Fortran 77
- Fortran 90
- Octave (should be compatible with Matlab)
- Perl 5
- Perl 6
- Python 2
- Python 3
- 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 systems, x86 Ubuntu 12.10 and
x86_64 Linux Mint 14, with required packages installed as documented
in each source file. (Linux Mint is derived from Ubuntu).
I intend to set up a fresh installation of Ubuntu 12.10 x86_64 system on a virtual machine to confirm that all tests will pass when the specified packages are installed. I'll write and publish a script to automate the entire process.
I don't have a B compiler. Instead, I use
sed to translate
fizzbuzz.b to equivalent C code, which I then compile and
execute. I can't guarantee that the translation (which is extremely
ad-hoc) is correct.
Do not take this too seriously.