Skip to content

Instantly share code, notes, and snippets.

@savaged savaged/FizzBuzz.cs
Created May 22, 2019

Embed
What would you like to do?
Fizz Buzz
namespace FizzBuzz
{
class Program
{
static void Main(string[] args)
{
for (var i = 1; i < 17; ++i)
{
var s = string.Empty;
var r = i % 3;
if (r == 0)
{
s = "Fizz";
}
r = i % 5;
if (r == 0)
{
s += "Buzz";
}
if (s == string.Empty)
{
s = i.ToString();
}
Console.WriteLine(s);
}
Console.WriteLine("Done!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.