Reading the coding horror, I just came across the FizzBuzz another time.
The original post is here: Coding Horror: Why Can\'t Programmers.. Program?
For thos
I tried to solve this problem without looking at the answers. It took me 3 hours to succeed. (I'm just a hobby programmer by the way so don't bash me hard please :)) This is my c# version solution:
static void Main(string[] args)
{
for (int i = 1; i <= 100; i++)
{
if( ((i % 3) != 0) && ((i % 5) != 0))
{
WriteLine($"{i}");
}
else
{
if ((i % 15) == 0)
{
WriteLine("FizzBuzz");
}
else if ((i % 3) == 0)
{
WriteLine("Fizz");
}
else if ((i % 5) == 0)
{
WriteLine("Buzz");
}
}
}
}