#include <iostream>
using namespace std;
int main() {
cout << "Podaj liczbę do sprawdzenia, czy jest liczbą pierwszą" << endl;
int n;
cin>>n;
bool p=1;
for (int i=2;i<n;i++)
if(n%i==0)
p=0;
if (p)
cout << "liczba " <<n<< " jest liczbą pierwszą" << endl;
else
cout << "liczba " <<n<< " nie jest liczbą pierwszą" << endl;
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: