Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include<bits/stdc++.h>
- #define ll long long
- #define ull unsigned long long
- using namespace std;
- bool is_prime (ull n){
- if (n<2 || (n%2 == 0 && n != 2 )) return false ;
- for(int i= 3 ; i<sqrt(n) ; i+=2){
- if (n % i == 0) return false;
- }
- return true;
- }
- int main() {
- ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
- ull n ;
- cin>>n;
- if (is_prime(n)) cout<<"YES";
- else cout<<"NO";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement