Last active
August 29, 2015 14:05
-
-
Save fordarnold/2c823b8bcf07cf2ca416 to your computer and use it in GitHub Desktop.
Java Class for the popular Fizz-Buzz game :D
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* FizzBuzz java class | |
* | |
* @author David Levine | |
* @source Quora.com | |
* | |
**/ | |
public class FizzBuzz { | |
public static void main(String[] args) { | |
for (int i=1; i <= 100; i++) { | |
if (i%15 == 0) | |
System.out.println("FIZZ-BUZZ"); | |
else if (i%3 == 0) | |
System.out.println("FIZZ"); | |
else if (i%5 == 0) | |
System.out.println("BUZZ"); | |
else | |
System.out.println(i); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment