How To Write BuzzFizz Program in Java


In this tutorial we will learn BuzzFizz Program in Java. The concept of this BuzzFizz program is the multiples of 3 will replacw with "Fizz", the multiples of 5 will replace with "Buzz" and the multiples of both 3 and 5 will replace with "FizzBuzz".In this program we are going to use the for loop and if,else and else if statement. This type of program are often asked in a job interview.

How To Write BuzzFizz Program in Java

BuzzFizz Program in Java

class BuzzFizz { public static void main(String arg[]) { int no, i; Scanner s=new Scanner(; System.out.println("Enter range of numbers");; for(i=1; i<=no; i++) { if((i % (3*5)) == 0) { System.out.println("FizzBuzz\n"); } else if ((i % 5) == 0) { System.out.println("Buzz\n"); } else if ((i % 3) == 0) { System.out.println("Fizz\n"); } else { System.out.println(i); } } } }


Enter Range of number: 20 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz
                  Liked Article? Please Buy me a Coffee 😭

Want to Clear Java Interview? Read Java Interview Notes prepared by Us

Are You Good enough in Java?

Learn Python in a Week and Master It


Need Programming Help??

Below Offers ends in

Quiz For You:

Search Tags

    Java Buzz fizz

    Fizz buzz program in Java