Created
May 8, 2017 20:34
-
-
Save phantamanta44/0d6e9abf97ad39b06d7e4966467b82a7 to your computer and use it in GitHub Desktop.
sort of inefficient fizzbuzz implementation 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 = 0; i < args.length; i++) { | |
int n = Integer.parseInt(args[i]); | |
String out = ((n % 3) == 0 ? "Fizz" : "") + ((n % 5) == 0 ? "Buzz" : ""); | |
System.out.println(out.isEmpty() ? Integer.toString(n) : out); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment