Created
May 23, 2014 06:49
-
-
Save dedg3/d53d054707c3f1d68e9a to your computer and use it in GitHub Desktop.
C# FizzBuzz
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
// C# FizzBuzz Test | |
using System; | |
class FizzBuzz { | |
static void Main() { | |
for (int n = 1; n <= 100; n ++) { | |
if (n % 15 == 0) { | |
Console.WriteLine("FizzBuzz"); | |
} | |
else if (n % 3 == 0) { | |
Console.WriteLine("Fizz"); | |
} | |
else if (n % 5 == 0) { | |
Console.WriteLine("Buzz"); | |
} | |
else { | |
Console.WriteLine(n); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment