Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <bits/stdc++.h>
- using namespace std;
- bool prime(int n){
- for (int i = 2; i * i <= n; i++){
- if (n % i == 0) return false;
- }
- return true;
- }
- int main() {
- int m;
- cin >> m;
- for (int i = 0; i < m; i++) {
- int n;
- cin >> n;
- if (n < 5 || n == 6) cout << "YES" << '\n';
- else if (!prime(n)) cout << "NO" << '\n';
- else {
- cout << "YES" << '\n';
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement