import java.util.Scanner;
    public class Provaex2 {
        public static void main(String[] args) {
            Scanner sc = new Scanner(System.in);

            System.out.println("Quantidade de numeros magicos: ");
            int quantidade = sc.nextInt();

            int contadorMagico = 0;
            while ( contadorMagico < quantidade) {
                System.out.println("Digite um numero: ");
                int N = sc.nextInt();

                if (N % 3 == 0 && N % 5 != 0) {
                    System.out.println("Magicos " + N);
                    contadorMagico++;
                } else { 
                    System.out.println("Comum " + N);
                }
            }
            
            sc.close();
        }
    }

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: