-
-
Save profesor79/e816fe40b98da63903716f5d0600fa24 to your computer and use it in GitHub Desktop.
This file contains 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
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