Skip to content

Instantly share code, notes, and snippets.

Created November 9, 2015 17:28
Show Gist options
  • Save anonymous/5abe9e3ca45fecd7a3fa to your computer and use it in GitHub Desktop.
Save anonymous/5abe9e3ca45fecd7a3fa to your computer and use it in GitHub Desktop.
using System;
class BuzzFizz
{
static void Main()
{
Console.Write("Enter the starting positive integer number: ");
uint start = uint.Parse(Console.ReadLine());
Console.Write("Enter the ending positive integer number: ");
uint end = uint.Parse(Console.ReadLine());
uint arrNum = end - start;
uint[] endArr = new uint[arrNum];
for (uint i = 0; i <= endArr.Length; i++)
{
if (start % 5 == 0 && start % 3 == 0)
{
string buzz = "Buzz-Fizz";
Console.WriteLine(buzz);
}
else if (start % 3 == 0)
{
string buzz = "Buzz";
Console.WriteLine(buzz);
}
else if (start % 5 == 0)
{
string buzz = "Fizz";
Console.WriteLine(buzz);
}
else Console.WriteLine(start);
++start;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment