fizz Buzz - Java java.lang

Java examples for java.lang:int

Description

fizz Buzz

Demo Code


//package com.java2s;

public class Main {
    private static void fizzBuzz() {
        for (int i = 0; i <= 100; i++) {
            if (i == 0)
                continue;
            if (i % 3 == 0 && i % 5 == 0)
                System.out.println("FIZZBUZZ");
            else if (i % 3 == 0)
                System.out.println("FIZZ");
            else if (i % 5 == 0)
                System.out.println("BUZZ");
            else// w  ww.j a v  a2  s  . c  o m
                System.out.println(i);
        }
    }
}

Related Tutorials