Untitled
unknown
plain_text
2 years ago
322 B
8
Indexable
#include <iostream>
#include <cmath>
using namespace std;
bool IsPrime(int x)
{
float b;
int l=0;
b = sqrt(x);
for (int i = 2; i < b; i++) {
if (x % i == 0) {
return 0;
}
}
return 1;
}
int main()
{
int x;
cin >> x;
if (IsPrime(x) == 0) {
cout << "NO";
}
else { cout << "YES"; }
}Editor is loading...
Leave a Comment