FizzBuzz

by JasonRShaver 31. May 2007 16:36

 Ok, I guess other people are finally figuring out what I have long known.  What is the difference between a script writer and a developer? 

Well Jeff Atwood wrote a good blog post on this topic ( http://www.codinghorror.com/blog/archives/000781.html ). 

Here I post, for anyone who cares (and no one does), my answer to FizzBuzz which I wrote in 1 minute 42 seconds (C#):

using System;
 
namespace FizzBuzz
{
    class Program
    {
        static void Main(string[] args)
        {
            for (int x = 1; x < 101; x++)
            {
                Console.Write("{0}: ", x);
                if (x % 3 == 0)
                    Console.Write("Fizz");
                if (x % 5 == 0)
                    Console.Write("Buzz");
                Console.Write("\n");
            }
            Console.ReadLine();
        }
    }

}

I can also program a loop in every language in my Resume that goes from 1 to 10 without any "off by one" bugs, and can solve problems using recursion and do it on a whiteboard. 

Tags:

Blog

About the author

I am a software developer working for Microsoft in Redmond, WA.  In addition, my wife and I own TTXOnline, what is likely the 3rd largest table tennis store in the US.

Month List

Page List