I'm trying to pick out whether or not a prime number is given by a user, when they input a number. This is what I have, but it' not working correctly....can anyone suggest anything?
#include <iostream>
using namespace std;
void main()
{
int n;
while (true)
{
cout << "Enter an integer: "; cin >> n;
if (n!=2 && (n%2==0 || n%3==0 || n%5==0))
cout << "Not Prime" << endl;
else
cout << "Prime" << endl;
}
cout << endl;
}