Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int n,i;
- cout<<"Enter number: "<<"\n";
- cin>>n;
- for(i=2; i<n; i++)
- {
- if(n%i == 0)
- {
- cout<<"Not Prime!!";
- return 0;
- }
- }
- if(i == n || n == 1)
- {
- cout<<"Prime";
- }
- else
- cout<<"Not prime";
- }
Add Comment
Please, Sign In to add comment