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

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

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

                if (n % 3 == 0 && n % 5 != 0) {
                    System.out.println("Mágico: " + n);
                    contador++;
                } else { 
                    System.out.println("Comum: " + n);
                }
                contador++;

                if(contador == quantidade){
                    break;
                }
            }
            
            sc.close();
        }
    }

Embed on website

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