n // Java Examples in a Nutshell, p.
12
n // Rewrite this program using iterators
with no “for” or “%”
n public class FizzBuzz {
n public static void main(String[]
args) {
n for (int i=1;i<=100;i++) {
n if ((i%5)==0 &&
(i%7)==0)
n
System.out.print(“fizzbuzz”);
n else if ((i%5)==0)
n
System.out.print(“fizz”);
n else if ((i%7)==0)
n
System.out.print(“buzz”);
n else
n System.out.print(i);
n System.out.print(“ “);
n }
n System.out.println();
n }
n }