Fizz Buzz game C#


Write a program that prints the numbers from 1 to 100. But for multiples of three print “Fizz” instead of the number and for the multiples of five print “Buzz”. For numbers which are multiples of both three and five print “FizzBuzz”.

//FizzBuzz Game
for (int i = 1; i <= 100; i++)
{
    if (i % 3 == 0 && i % 5 == 0)
    {
        Console.WriteLine("FizzBuzz");
    }
    else if (i % 3 == 0)
    {
        Console.WriteLine("Fizz");
    }
    else if (i % 5 == 0)
    {
        Console.WriteLine("Buzz");
    }
    else
    {
        Console.WriteLine(i);
    }
}
Console.ReadKey();

3 thoughts on “Fizz Buzz game C#

  1. Sambit Mohanty

    Hi Hitesh,

    Can you please send me the source code of WPF with MVVM Crud application.

    Thanks,
    Sambit

    1. Hitesh Kumar Post author

      You try to implement from site code. If there is any problem, I will help you.
      Regards
      Hitesh

Comments are closed.