Skip to content

Instantly share code, notes, and snippets.

@profesor79
Created March 22, 2023 13:42
Show Gist options
  • Save profesor79/e816fe40b98da63903716f5d0600fa24 to your computer and use it in GitHub Desktop.
Save profesor79/e816fe40b98da63903716f5d0600fa24 to your computer and use it in GitHub Desktop.
public void DoFizzBuzz()
{
for (int i = 1; i <= 100; i++)
{
bool fizz = i % 3 == 0;
bool buzz = i % 5 == 0;
if (fizz && buzz)
Console.WriteLine ("FizzBuzz");
else if (fizz)
Console.WriteLine ("Fizz");
else if (buzz)
Console.WriteLine ("Buzz");
else
Console.WriteLine (i);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment