public class fizzbuzz { public static void main(String[] args) { int i = 0; while(i < 100) { i++; if(i % 3 != 0) { System.out.println(i); } else if(i % 5 != 0) { System.out.println(i); } if(i % 3 == 0) { System.out.println("FIZZ"); } if(i % 5 == 0) { System.out.println("BUZZ"); } if(i % 3 == 0 && i % 5 == 0) { System.out.println("FIZZBUZZ"); } } } }
when the numbers prints out , i don't want it to print the i but just the specific system.out.println command.like the number 3 and 5 shouldn't be printed out but just FIZZ or BUZZ or FIZZBUZZ... please help me