-
-
Save neildanson/75f1337b5664d6ab64f9357c6a74cd25 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 FizzBuzz | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
for(int i=1;i<=100;i++) { | |
switch (new { mod3 = i % 3, mod5 = i % 5 }) { | |
case var t when t.mod3 == 0 && t.mod5 == 0: | |
Console.WriteLine("FizzBuzz"); | |
break; | |
case var t when t.mod3 == 0: | |
Console.WriteLine("Fizz"); | |
break; | |
case var t when t.mod5 == 0: | |
Console.WriteLine("Buzz"); | |
break; | |
default: | |
Console.WriteLine(i); | |
break; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment