Created
March 23, 2014 21:46
-
-
Save damonjmurray/9730383 to your computer and use it in GitHub Desktop.
A FizzBuzz solution that uses a Custom Numeric Format string to produce the desired output
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 System; | |
namespace FizzBuzzCustomNumericFormatter | |
{ | |
public class Program | |
{ | |
public static void Main(string[] args) | |
{ | |
const string format = "{0:#;}{1:;;Fizz}{2:;;Buzz}"; | |
for (int i = 1; i <= 100; i++) | |
Console.WriteLine(format, i % 3 * i % 5 == 0 ? 0 : i, i % 3, i % 5); | |
Console.ReadLine(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment