/**
* “Write a program that prints the numbers from 1 to 100.
* But for multiples of three print “Fizz” instead of the
* number and for the multiples of five print “Buzz”.
* For numbers which are multiples of both three and five print “FizzBuzz”."
*
* It uses the modulo operator (%) to determine if a number is divisible by another
*/
public class FizzBuzz//everything in Java is a class
{
public static void main(String [] args)//Every program must have main()
{
for (int i=1; i<=100; i++)//count from 1 to 100
{
if (i%3!=0 && i%5!=0)//NOT both?
System.out.println(i);//just print i
else
{
if (i%3==0) System.out.print("Fizz");//multiple of 3? Display Fizz
if (i%5==0) System.out.print("Buzz");//multiple of 5? Display Buzz
// if it is both, by NOT having 'else', it automatically become FizzBuzz
System.out.println();
}
}
}
}