Last active
June 7, 2016 09:29
-
-
Save FedericoPonzi/3f119ad63dc260d0c18a to your computer and use it in GitHub Desktop.
My solution for the fizzbuzz test, in java
This file contains hidden or 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 FizzBuzzTest | |
{ | |
public static void main(String[] args) | |
{ | |
for (int i = 1; i <= 100; i++) | |
{ | |
String toPrint; | |
if(i%3 == 0 && i%5 == 0) | |
toPrint = "FizzBuzz"; | |
else if(i%3 == 0) | |
toPrint = "Fizz"; | |
else if(i%5 == 0) | |
toPrint = "buzz"; | |
else | |
toPrint = "" + i; | |
System.out.println(toPrint); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment