Thursday, April 15, 2010

Find Developers who Grok Coding

I just read, a post about this FizzBuzz thing, here then go to the original post. Then, i write the code in Java just for poc.

Here is my code

public class FizzBuzz {
  public static void main(String[] args) {
    for(int i = 1; i < 101; i++) {
      if (i % 3== 0 || i % 5 == 0) {
        if (i % 3 == 0)
        System.out.print("Fizz");
        if (i % 5 == 0)
        System.out.print("Buzz");
      }
      else
      System.out.print(i);
      System.out.println("");
    }
  }
}