Skip to content

Instantly share code, notes, and snippets.

@bjhaid
Created November 20, 2013 03:00
Show Gist options
  • Save bjhaid/7556952 to your computer and use it in GitHub Desktop.
Save bjhaid/7556952 to your computer and use it in GitHub Desktop.
Fizzbuzz in Java
public class FizzBuzz{
public static void main(String[] args){
int i = 0;
while(i <= 100){
if ((i % 15) == 0)
System.out.println("FizzBuzz");
else if ((i % 5) == 0)
System.out.println("Buzz");
else if ((i % 3) == 0)
System.out.println("Fizz");
else
System.out.println(i);
i += 1;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment