Untitled
unknown
c_cpp
a year ago
310 B
3
Indexable
#include <iostream> #include <math.h> using namespace std; bool IsPrime(int x) { for (int i = 2; i <= sqrt(x); i++) { if (x % i == 0) return false; } return true; } int main() { int x; cin >> x; IsPrime(x); if (IsPrime(x) == 1) { cout << "YES"; } else { cout << "NO"; } }
Editor is loading...
Leave a Comment