Assignment #85 and Fizz Buzz
Code
/// Name: Graham Pollock
/// Period: 5
/// Program Name: FizzBuzz
/// File Name: FizzBuzz.java
/// Date Finished: 02/12/2016/
public class FizzBuzz
{
public static void main(String[] args)
{
for (int n=1; n <= 100; n++)
{
int t = n % 3;
int f = n % 5;
if (t == 0 && f == 0)
{
System.out.println("FizzBuzz");
}
else if (t == 0 && f != 0)
{
System.out.println("Fizz");
}
else if (t != 0 && f == 0)
{
System.out.println("Buzz");
}
else
{
System.out.println(n);
}
}
}
}
Picture of the output