Assignment #85 FizzBuzz
Code
///Name: Mark Katz
///Period: 6
///Program Name: Fizz Buzz
///File Name: FizzBuzz.java
///Date Finished: 11/10/15
public class FizzBuzz
{
public static void main( String[] args )
{
for ( int x =1; x <= 100; x ++)
{
int n = x % 3;
int y = x % 5;
if ( n == 0 && y != 0)
{
System.out.println( "Fizz" );
}
else if( y == 0 && n != 0)
{
System.out.println( "Buzz" );
}
else if ( n == 0 && y == 0 )
{
System.out.println( "FizzBuzz" );
}
else
{
System.out.println(x);
}
}
}
}
Picture of the output