diff --git a/java/.gitignore b/java/.gitignore new file mode 100644 index 0000000..e10e727 --- /dev/null +++ b/java/.gitignore @@ -0,0 +1 @@ +/.metadata/ diff --git a/java/fizzbuzz_method.java b/java/fizzbuzz_method.java new file mode 100644 index 0000000..1b3c0f0 --- /dev/null +++ b/java/fizzbuzz_method.java @@ -0,0 +1,30 @@ +package fizzbuzzPull; + +public class fizzbuzz_method { + + public static void main(String[] args) { + + for(int i = 0; i <= 100; i++) { + System.out.println(fizzBuzz(i)); + } + + + + } + + public static String fizzBuzz(int number) { + String output = ""; + + if(number % 5 == 0 && number % 3 == 0 ) { + output += "FizzBuzz"; + } else if (number % 5 == 0) { + output += "Buzz"; + }else if (number % 3 == 0) { + output += "Fizz"; + } else { + output += number; + } + return output; + } + +}