FizzBuzz paper-solution
string[] formatStrings =
new string[] { "{0}", "Fizz", "Buzz", "FizzBuzz" }; for (int i = 1; i < 101; i++) { int index = (3 - i % 3) / 3 + ((5 - i % 5) / 5) * 2; Console.WriteLine(formatStrings[index], i); }
Welcome to the dark side.
ARCHIVED
string[] formatStrings =
new string[] { "{0}", "Fizz", "Buzz", "FizzBuzz" }; for (int i = 1; i < 101; i++) { int index = (3 - i % 3) / 3 + ((5 - i % 5) / 5) * 2; Console.WriteLine(formatStrings[index], i); }