View the step-by-step solution to:

If the number is divisiable by 3 print out "fizz" 2.

Design a program to print out numbers from 1 to 20 (please show Java code of program)


1. If the number is divisiable by 3 print out "fizz"

2. If the number is divisible by 5 print out "buzz"

3. IF the number is divisible by both 3 & 5 print out "fizzbuzz"

4. Else just print out the number

Sign up to view the entire interaction

Top Answer

Dear Student , PFA the solution . I have... View the full answer


public class DivisibilityTest { public void divisible(int i) { //if no. is divisible by 3 & 5 both if (i % 3 == 0 && i % 5 == 0) { System.out.println("fizzbuzz"); } //if no....

Sign up to view the full answer

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.


Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question
Ask a homework question - tutors are online