Guest User

fizzBuzz java

a guest
Apr 21st, 2012
816
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. public class fizzBuzz
  2. {
  3.   public static void main (String args[])
  4.   {
  5.     for (int i=1; i<=100; i++)
  6.     {
  7.       if (i%3 == 0)
  8.       {
  9.         if (i%5==0)
  10.           System.out.println("FizzBuzz");
  11.         else
  12.           System.out.println("Fizz");
  13.       }
  14.       else
  15.       {
  16.         if (i%5 == 0)
  17.           System.out.println("Buzz");
  18.         else
  19.           System.out.println(i);
  20.       }
  21.     }
  22.   }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment