numero = int(input("Ingresa un número entero positivo: "))

while numero <= 0:
    print("Error. Solo se permiten números enteros positivos.")
    numero = int(input("Ingresa un número entero positivo: "))

if numero == 1:
    print("El 1 no es un número primo.")
else:
    primo = True

    for i in range(2, numero):
        if numero % i == 0:
            primo = False
            break

    if primo:
        print("El número es primo.")
    else:
        print("El número no es primo.")

Embed on website

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