LogicMonitor Interview Question

Coding/Programming Question: Fizz-Buzz - A very common general programming question to quickly white board that shows a general knowledge of writing code.

Interview Answers

Anonymous

Dec 28, 2016

Wrote out a quick Java example. Simple and easy.

Anonymous

Mar 8, 2020

public static void main(String[] args) { int[] intArr = { 3, 15 }; //number of test cases, here 2 for (int i = 0; i < intArr.length; i++) { for (int j = 1; j <= intArr[i]; j++) { if (j % 15 == 0) { System.out.print("FizzBuzz "); } else if (j % 3 == 0) { System.out.print("Fizz "); } else if (j % 5 == 0) { System.out.print("Buzz "); } else { System.out.print(j+" "); } } System.out.println(); } }