Fizz Buzz in C#

Published on 14 August 2018 (Updated: 26 March 2019)

Welcome to the Fizz Buzz in C# page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

namespace FizzBuzz
{
    public class Program
    {
        public static string FizzBuzz(int number)
        {
            string temp = "";
            if (number % 3 == 0)
            {
                temp += "Fizz";
            }
            if (number % 5 == 0)
            {
                temp += "Buzz";
            }
            if (string.IsNullOrEmpty(temp))
            {
                temp += number;
            }
            return temp;
        }

        private static void Main(string[] args)
        {
            for (int i = 1; i <= 100; i++)
            {
                string line = FizzBuzz(i);
                System.Console.WriteLine(line);
            }
        }
    }
}

Fizz Buzz in C# was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.