Skip to content

Instantly share code, notes, and snippets.

@joe-scalise
Created November 8, 2018 20:21
Show Gist options
  • Select an option

  • Save joe-scalise/b442917e8b951d071a9263b5a8b39bdb to your computer and use it in GitHub Desktop.

Select an option

Save joe-scalise/b442917e8b951d071a9263b5a8b39bdb to your computer and use it in GitHub Desktop.
FizzBuzz
using System;
namespace FizzBuzz
{
class Program
{
static void Main(string[] args)
{
for (int n = 1; n <101; n++){
if (n%3 == 0) {
if (n%5 == 0) {
Console.WriteLine("FizzBuzz");
continue;
} else {
Console.WriteLine("Fizz");
}
}
else if (n%5 == 0) {
Console.WriteLine("Buzz");
}
else {
Console.WriteLine(n.ToString());
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment