Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- bool isPrime(int x) {
- if (x < 2) return 0;
- int sq = sqrt(x);
- for (int i = 2; i <= sq; i++) {
- if (x % i == 0) {
- return false;
- }
- }
- return true;
- }
- int main(){
- int n;
- cin >> n;
- if (isPrime(n)) {
- cout << "Yes\n";
- } else {
- cout << "No\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement