package p05_petle.zadania;

import java.util.Scanner;

public class FizzBuzz2 {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.print("Podaj limit: ");
        int limit = scanner.nextInt();
        int ile = 0;
        
        for(int i = 1; i <= limit; i++) {
            if(i % 3 == 0 || i % 5 == 0) {
                ile ++;
                if(i % 3 == 0) {
                    System.out.print("Fizz");
                }
                if(i % 5 == 0) {
                    System.out.print("Buzz");
                }
                System.out.println(" " + i);
            }
        }
        System.out.println("Liczba wystąpień: " + ile);
    }
}
