Created
August 30, 2012 04:48
-
-
Save tprochazka/3522476 to your computer and use it in GitHub Desktop.
FizzBuzz
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 { | |
/** | |
* @param args | |
*/ | |
public static void main(String[] args) { | |
for (int i=1; i <= 100; i++) { | |
boolean m3 = i%3==0; | |
boolean m5 = i%5==0; | |
if (m3 && m5) { | |
System.out.println("FizzBuzz"); | |
} else if (m3) { | |
System.out.println("Fizz"); | |
} else if (m5) { | |
System.out.println("Buzz"); | |
} else { | |
System.out.println(i); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment