Created
March 22, 2016 14:26
-
-
Save rnelson/2ff681d73c943ed5af1a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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