FizzBuzz
FizzBuzz is a common example to test whether someone is competent in programming. The assignment is to write a program which prints 1 to 100. For every multiple of 3 print ‘Fizz’ and for every multiple of 5 print ‘Buzz’. For every multiple of 3 _and_ 5 print ‘FizzBuzz’.
The trick is that most of the time only competent programmers know of the “modulo” operator (% in C, C++, C# and others). Silly thing is: it’s usually true! Why? No one knows…
Competent programmers should be able to com up with this under 5 minutes:
C#:
Now don’t rely on this example. There are other tests out there. Still, it’s quite funny to see your colleagues struggle with something so simple and finally bang their head against the table if you tell them the trick.
The trick is that most of the time only competent programmers know of the “modulo” operator (% in C, C++, C# and others). Silly thing is: it’s usually true! Why? No one knows…
Competent programmers should be able to com up with this under 5 minutes:
C#:
1 | for (int i = 1; i <= 100; i++)
|
Now don’t rely on this example. There are other tests out there. Still, it’s quite funny to see your colleagues struggle with something so simple and finally bang their head against the table if you tell them the trick.
|
|
Microsoft DevDays 2007 |
Comments
You think it is "funny" that your colleagues don't know this "trick"? I would say it is painfull.