Created
December 30, 2016 15:59
-
-
Save mmowbray/4781d4b82446c855ed36c02b4e7d6328 to your computer and use it in GitHub Desktop.
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) { | |
String output; | |
for(int i = 1; i <= 100; i++){ | |
if(i % 3 == 0 || i % 5 == 0){ | |
output = ""; | |
if(i % 3 == 0) | |
output += "Fizz"; | |
if(i % 5 == 0) | |
output += "Buzz"; | |
} | |
else{ | |
output = "" + i; | |
} | |
System.out.println("["+i+"]: " + output); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment