fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n;
  7. cin >> n;
  8. if(n < 2)
  9. {
  10. cout<<"NO"<<endl;
  11. return 0;
  12. }
  13. for(int i = 2 ; i < n; i++)
  14. {
  15. if(n % i == 0)
  16. {
  17. cout<<"NO"<<endl;
  18. return 0;
  19. }
  20. }
  21. cout<<"YES"<<endl;
  22. }
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
NO