Skip to content

Instantly share code, notes, and snippets.

@Descalon
Forked from JeremyMorgan/fizzbuzz.cs
Last active December 19, 2015 12:19
Show Gist options
  • Save Descalon/5953675 to your computer and use it in GitHub Desktop.
Save Descalon/5953675 to your computer and use it in GitHub Desktop.
My most compact, sensible and readable answer to the FizzBuzz problem.
using System;
namespace CrapTester_vs10 {
public class Program {
static void Main(string[] args) {
string s;
for (int i = 1; i < 100; i++) {
s = "";
if (i % 3 == 0)
s += "Fizz";
if (i % 5 == 0)
s += "Buzz";
if (s == "")
s = i.ToString();
Console.WriteLine(s); //LOG
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment