Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int isPrime(int x, int d)
- {
- if (x == 1)
- return 0;
- if (d == 1)
- return 1;
- if (x % d == 0)
- return 0;
- return isPrime(x, d - 1);
- }
- int main()
- {
- int x;
- cin >> x;
- cout << isPrime(x, x / 2);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement