Last active
August 29, 2015 14:16
-
-
Save phase/ebb38036bc2cb73d1db7 to your computer and use it in GitHub Desktop.
The easiest thing I've ever made....
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
for(i=0;i<100;)console.log((++i%3?'':'Fizz')+(i%5?'':'Buzz')||i) |
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 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); | |
} | |
} | |
} | |
} |
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 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