FizBuzz program: how to make the output correct?
I got a question about this program, it says: The FizzBuzz Challenge: Display numbers from 1 to x, replacing the word 'fizz' for multiples of 3, 'buzz' for multiples of 5 and 'fizzbuzz' for multiples of both 3 and 5. Th result must be:1 2 fizz 4 buzz fizz 7 8 fizz buzz 11 fizz 13 14 fizzbuzz 16 ... So my problem is at the time to print the output, I dont know what to do. public class Multiplos { public static void main(String args[]) { for (int i = 1; i <= 100; i++) { if (i % 3 == 0) { System.out.print(i + " "); System.out.print(" fizz "); } if (i % 5 == 0) { System.out.print(" " + i); System