Untitled
unknown
plain_text
a year ago
322 B
3
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