Assignemnt #87
Code
/// Name: Connor Siri
/// Period: 7
/// Program Name: Fizz
/// File Name: Fizz.java
/// Date Finished: 12/3/2015
import java.util.Scanner;
public class Fizz
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
for ( int n = 1 ; n <= 100; n = n+1)
{
int x = n % 3;
int y = n % 5;
if (x == 0 && y == 0)
{
System.out.println("FizzBuzz");
}
else if (x == 0 && y != 0 )
{
System.out.println("Fizz");
}
else if ( x != 0 && y == 0 )
{
System.out.println("Buzz");
}
else
{
System.out.println(n);
}
}
}
}
Picture of the output