Java Bootcamp – Workbooks and Challenges
)}

Workbook 5.7

From the Java Bootcamp Resources, launch Workbook 5.7.

7.png

Fizz Buzz

Your program has to print numbers from 0 to 18.

  • If a number is a multiple of three, mark it: Fizz.

  • If a number is a multiple of five, mark it: Buzz.

  • If a number is a multiple of three and five, mark it: FizzBuzz.

Task 1


Make a for loop that counts from 0 to 18 and print each number.

>>: 0
>>: 1
>>: ...
>>: 18

Task 2


Set up an if - else if - else statement.

  • if the number is a multiple of three, mark it: Fizz.

  • if the number is a multiple of five, mark it: Buzz.

  • if the number is a multiple of three and five, mark it: FizzBuzz.

Hints:

  • A number is a multiple of X if number ÷ X results in a remainder of zero.

  • There are three conditions for Fizz, Buzz, and FizzBuzz. Be careful about their order. If something is FizzBuzz, it also satisfies the conditions for Fizz and Buzz.

Visualizing the Runtime

After you solve this workbook, I still recommend watching the video solution on Udemy.

7.png

It will show you how to visualize the runtime using Visual Studio Code.


Associated Course: The Complete Java Development Bootcamp
Related Course: The Complete Spring Boot Development Bootcamp – Become a Java Web Developer

Feedback Summary
4.7
43 students
5

91%
4

2%
3

0%
2

0%
1

7%
Written Reviews
There are no written reviews yet.