Question: Java: Write the code to recreate the fizz buzz game that prints numbers 1 through 100 but when a number is divisible by 3, it

Java: Write the code to recreate the fizz buzz game that prints numbers 1 through 100

but when a number is divisible by 3, it needs to print Fizz

when a number is divisible by 5, it needs to print Buzz

when a number is divisible by both 3 & 5, it needs to print Fizzbuzz

and the actual number itself, if it is not divisble by 3 or 5.

Output should be like the following: the ... in the middle means the series continues

1

2

fizz

4

buzz

fizz

7

8

fizz

buzz

11

fizz

13

14

fizzbuzz

16

17

fizz

19

buzz

fizz

....

fizzbuzz

91

92

fizz

94

buzz

fizz

97

98

fizz

buzz

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!