#include <iostream>
using namespace std;
int main() {
int numero;
bool esPrimo = true;
cout << "Numero: ";
cin >> numero;
if (numero <= 1) {
cout << "Por favor, ingrese un entero mayor que 1." << endl;
} else {
for (int i = 2; i <= numero / 2; i++) {
if (numero % i == 0) {
esPrimo = false;
break;
}
}
if (esPrimo) {
cout << numero << " es primo." << endl;
} else {
cout << numero << " no es primo." << endl;
}
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: