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