Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //PRIME NUMBER CHECK
- #include <iostream>
- using namespace std;
- int main()
- {
- int checknum, remainder;
- cout<<"enter num to check"<<endl;
- cin>>checknum;
- remainder = checknum%2;
- cout<<remainder<<endl;
- if (remainder==1)
- {
- cout<<"Prime"<<endl;
- }
- else if (remainder == 0)
- {
- cout<<"not prime"<<endl;
- }
- else
- {
- cout<<"error"<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement