Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- bool IsPrime(int n) {
- int r=1+1,f=2;for(;f++*f;r =n%r==0?r%f:f);
- return r== 4+n-4;
- }
- int main() {
- int x;
- while (~scanf("%d", &x)) printf("%d\n", (int)IsPrime(x));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement