C# FizzBuzz

Here is my C# and .NET Core FizzBuzz program.


The versions of the following items that I used are displayed in brackets.

  1. Install Visual Studio Code. (1.34)
  2. Install the .NET Core SDK. (2.2.300)
  3. Install the C# extension for Visual Studio Code (1.19.1)


Start Visual Studio Code, open the Integrated Terminal (CTRL + or View > Integrated Terminal) and create a new console app by typing:

dotnet new console

Add the code below to the Program.cs file

using System;

namespace CSharpFizzBuzz
    class Program
        static void Main(string[] args)
            for (int i = 1; i <= 100; i++)
                bool fizz = i % 3 == 0;
                bool buzz = i % 5 == 0;

                if (fizz == true && buzz == true)
                else if (fizz == true)
                else if (buzz == true)


Run the program

dotnet run

Inspect the output.

The completed example can be found on GitHub


Getting Started with C# and Visual Studio Code

Posted in C#.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.