Created
June 23, 2015 23:21
-
-
Save dashersw/2ad158a4f7bedfe11327 to your computer and use it in GitHub Desktop.
Simple FizzBuzz in Java
This file contains 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 = 1; i < 100; i++) { | |
String output = ""; | |
if (i % 3 == 0) output += "Fizz"; | |
if (i % 5 == 0) output += "Buzz"; | |
System.out.println(output.isEmpty() ? i : output); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment