FizzBuzz You Choose




FizzBuzz You Choose the Divisors


FizzBuzz is a fun coding challenge. The word Fizz will replace all numbers evenly divisible by the Fizz number. Another number is assigned to Buzz and all numbers divisible. Any shared numbers divisible by both will display FizzBuzz.

*Featured Code Created By: Shane Overby





C#


//Original by Shane Overby

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace SoloLearn
{
    class Program
    {
        static void Main(string[] args)
        {
            //Enter a positive whole number less than or equal to 100 as the "Fizz" divisor
            int fizzNum = Int32.Parse(Console.ReadLine());
            
            //Enter a positive whole number less than or equal to 100 as the "Buzz" divisor
            int buzzNum = Int32.Parse(Console.ReadLine());
            
            Console.WriteLine($"This is the FizzBuzz exercise.\n\nUsing the integers you have specified,\nnumbers evenly divisible by {fizzNum} are\nreplaced with the word \"Fizz\" and numbers\nevenly divisible by {buzzNum} are replaced\nwith the word \"Buzz\". Numbers evenly\ndivisible by both {fizzNum} and {buzzNum} are replaced\nwith the word \"FizzBuzz\".\n");
            
            for(int i = 1; i <= 100; i++)
            {
                string output = "";
                if(i % fizzNum == 0)
                    output += "Fizz";
                if(i % buzzNum == 0)
                    output += "Buzz";
                if(string.IsNullOrWhiteSpace(output))
                    output = i.ToString();
                Console.WriteLine(output);
            }
        }
    }
}


Click here to view this Code



I hope you enjoyed this content please consider supporting the development of Free Code Examples


Thank you and have a Blessed Day




More Free Code Examples


Fibonacci Sequence Using C


C++ Odd or Even


C++ Code to Reverse a Number




Try these Fun Games by Bobbie:


Travel Blast Game New York


Play and Learn Russian


Battlestarship Game



Take a look at these Groovy Codes:


Fun IQ Test


Html Svg Starburst


Javascript Particles Fishes



Read the Latest Breaking Programming and Tech News, Great Articles and Tips:


Codenewz Programming and Tech News




Comments

Popular posts from this blog

Crypto Mining

Multi-tap Keypad Text Entry