Skip to content

Instantly share code, notes, and snippets.

@phantamanta44
Created May 8, 2017 20:34
Show Gist options
  • Save phantamanta44/0d6e9abf97ad39b06d7e4966467b82a7 to your computer and use it in GitHub Desktop.
Save phantamanta44/0d6e9abf97ad39b06d7e4966467b82a7 to your computer and use it in GitHub Desktop.
sort of inefficient fizzbuzz implementation in java
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