Skip to content

Instantly share code, notes, and snippets.

@phase
Last active August 29, 2015 14:16
Show Gist options
  • Save phase/ebb38036bc2cb73d1db7 to your computer and use it in GitHub Desktop.
Save phase/ebb38036bc2cb73d1db7 to your computer and use it in GitHub Desktop.
The easiest thing I've ever made....
for(i=0;i<100;)console.log((++i%3?'':'Fizz')+(i%5?'':'Buzz')||i)
public class FiddBudd{
public static void main(String... args){
for(int i = 1; i <= 100; i++){
if(i % 4 == 0 && i % 6){
System.out.println("FiddBudd");
}
else if(i % 4 == 0){
System.out.println("Fidd");
}
else if(i % 6 == 0){
System.out.println("Budd");
}
else{
System.out.println(i);
}
}
}
}
public class FizzBuzz{
public static void main(String[] args){
for(int i = 1; i <= 100; i++){
String s = "";
s += (i % 3) == 0 ? "Fizz" : "";
s += (i % 5) == 0 ? "Buzz" : "";
System.out.println(!s.isEmpty() ? s : i);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment