Skip to content

Instantly share code, notes, and snippets.

@stimms
Created June 15, 2011 16:26
Show Gist options
  • Save stimms/1027472 to your computer and use it in GitHub Desktop.
Save stimms/1027472 to your computer and use it in GitHub Desktop.
Linq fizzbizz
//silly
string result = Enumerable.Range(0, 100).Aggregate("", (current, nextValue) =>
{
if (nextValue % 3 != 0 && nextValue % 5 != 0)
{
current += nextValue;
}
if (nextValue % 3 == 0)
{
current += "Fizz";
}
if (nextValue % 5 == 0)
{
current += "Bizz";
}
return current + "\n";
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment