FizzBuzz (Code PoC)

2013-03-10 8:45 PM

Okay, let's test out some code styling. Here's a fizz-buzz implementation (with a couple of liberties taken to get it to smash down to one line):

public class Program
{
    public static void Main(string[] args)
    {
        Console.WriteLine
        (
            string.Join
            (
                Environment.Newline, 
                Enumerable.Range(1, 100)
                    .Select(a => 
                        a.ToString() + ": " +
                        (a % 3 == 0 ? "Fizz" : string.Empty) + 
                        (a % 5 == 0 ? "Buzz" : string.Empty)
                    )
            )
        );
        Console.Read();
    }
}