Skip to content

Instantly share code, notes, and snippets.

@rnelson
Created March 22, 2016 14:26
Show Gist options
  • Save rnelson/2ff681d73c943ed5af1a to your computer and use it in GitHub Desktop.
Save rnelson/2ff681d73c943ed5af1a to your computer and use it in GitHub Desktop.
using UnsignedInteger = System.UInt16; // Sorry, I can't unabbreviate it on the RHS
// https://twitter.com/taylonr/status/712277308363542530
namespace FizzBuzz
{
class Program
{
static void Main(System.String[] arguments)
{
System.String outputValue = System.String.Empty; // Yeah yeah, StringBuilder
for (UnsignedInteger currentNumber = 1; currentNumber <= 100; currentNumber += 1)
{
if (currentNumber % 3 == 0)
{
outputValue += "Fizz";
}
if (currentNumber % 5 == 0)
{
outputValue += "Buzz";
}
if (System.String.Empty == outputValue)
{
outputValue = currentNumber.ToString();
}
System.Console.WriteLine(outputValue);
outputValue = System.String.Empty;
}
System.Console.WriteLine();
System.Console.WriteLine("Done.");
System.Console.ReadKey();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment