After installing the Eclipse IDE and quickly going over some of the samples codes, I began to write my FizzBuzz program. It took me around 15 minutes to get the program working properly, a bit longer than I've expected. The output was coming out wrong because I was using all "if" statements at first rather than using "else if".
Running into problems with such a simple code tells me that I definitely need to review and refresh my java.
Below is my code for FizzBuzz
PUBLIC class FizzBuzz {
PUBLIC static void main(String[] args) {
FOR (INT i = 1; i <= 100; i++) {
IF (i % 15 == 0) {
System.out.println("FizzBuzz";
}
ELSE IF (i % 5 == 0) {
System.out.println("Buzz";
}
ELSE IF (i % 3 == 0) {
System.out.println("Fizz";
}
ELSE {
System.out.println(i);
}
}
}
}