Skip to content

ByeonghoonJeon/Fizzbuzz-Java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Fizzbuzz-Java

Fizzbuzz game This code substitute numbers to "Fizz", "Buzz", or "Fizzbuzz". Numbers that can be divided by 3 without remainder will be substituted to "Fizz". Numbers that can be divided by 5 without remainder will be substituted to "Buzz". Numbers that can be divided by 3 and 5 both without remainder will be substituted to "Fizzbuzz".

How it works?

Using modulous, every number will be checked whether it has remainder or not when it is divided by 3 or 5. If a number does not have remainder, substituted word will be added to the end of array. If a number has remainder, number it self will be added to the end of array.

"Fizz" will be added when the number can be divided by 3 but not by 5. "Buzz" will be added when the number can be divided by 5 but not by 3. "Fizzbuzz" will be added when the number can be divided by 3 and 5 both.