Last active
August 29, 2015 14:07
-
-
Save rshepherd/82d1cedce44da6089ef4 to your computer and use it in GitHub Desktop.
A solution to the FizzBuzz faux-quiz.
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
public class FizzBuzz { | |
public static void main(String[] args) { | |
for(int i = 0 ; i < 100 ; ++i) { | |
boolean fizz = i % 3 == 0; | |
boolean buzz = i % 5 == 0; | |
if (fizz && buzz) { | |
System.out.println("FizzBuzz"); | |
} else if (fizz) { | |
System.out.println("Fizz"); | |
} else if (buzz) { | |
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