Guest User

Untitled

a guest
Jun 17th, 2018
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdbool.h>
  3. #include <math.h>
  4.  
  5. bool isprim(long long n){
  6. if(n%2==0||n%3==0||n%5==0||n%7==0) return false;
  7. for(long long i=11;i<=sqrt(n);i+=2){
  8. if(i%3==0||i%5==0||i%7==0) continue;
  9. else if(n%i==0) return false;
  10. }
  11. return true;
  12. }
  13. int main(){
  14. long long n;
  15. scanf("%lld",&n);
  16. printf("%s\n",((isprim(n))? "Yes":"No"));
  17. return 0;
  18. }
Add Comment
Please, Sign In to add comment