Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- typedef long long ll;
- int main()
- {
- #ifndef ONLINE_JUDGE
- freopen("input.txt", "r", stdin);
- freopen("output.txt", "w", stdout);
- #endif
- int n;
- cin >> n;
- bool flag=true;
- for(int i=2;i<n/2;i++)
- {
- if(n%i==0)
- {
- flag = false;
- break;
- }
- }
- if(flag)
- printf("%d is a prime number\n",n);
- else
- printf("%d is not a prime number\n",n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement