diff --git a/problems/shortest-fizz-buzz/shortestFizzBuzz.java b/problems/shortest-fizz-buzz/shortestFizzBuzz.java new file mode 100644 index 00000000..12bc59c2 --- /dev/null +++ b/problems/shortest-fizz-buzz/shortestFizzBuzz.java @@ -0,0 +1,16 @@ +class ShortestFizzBuzz { + public static void main(String[] args) { + + for (int x = 1; x <= 100; x++) { + System.out.println(); + if (x % 3 == 0) { + System.out.print("fizz"); + } + if (x % 5 == 0) { + System.out.print("buzz"); + } if (x % 3 != 0 && x % 5 != 0) { + System.out.print(x); + } + } + } +}