Coder Social home page Coder Social logo

fizz-buzz's Introduction

Fizz-Buzz

Created by Muganga Eric

This code is an implementation of the Fizz Buzz problem. The Fizz Buzz problem is a popular programming problem that requires a program to print numbers from 1 to N, where N is an integer provided by the user. For each number, if the number is divisible by 3, the program should print "Fizz". If the number is divisible by 5, the program should print "Buzz". If the number is divisible by both 3 and 5, the program should print "Fizz Buzz". If the number is not divisible by either 3 or 5, the program should print the number itself.

The code starts with two Console.WriteLine statements that print out "Hello, World!" and "Welcome to the Fizz Buzz Program". Then, the user is prompted to enter an integer value using Console.Write and Console.ReadLine statements.

The value entered by the user is stored in the variable n, which is then passed as an argument to the FizzBuzz method.

The FizzBuzz method takes an integer n as an input parameter and implements a loop that iterates through the numbers from 1 to n. For each number i, the method uses if-else statements to check if i is divisible by 3, 5, both 3 and 5, or neither 3 nor 5. Depending on the divisibility, the method prints out "Fizz", "Buzz", "Fizz Buzz", or the number itself using Console.WriteLine statements.

Overall, this code implements the Fizz Buzz problem and provides a simple way for users to interactively enter an integer value and view the Fizz Buzz output.

fizz-buzz's People

Contributors

eric-muganga avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.