I am writing a program that outputs whether or not a number is prime. Can anyone help me find where my syntax error is? Also, i get that i = 3; i <= num; i++ would be true for it being a prime number from the other forums I have read but I honestly don't get why, can someone explain? I get everything else I have done thus far.
#include <iostream>
#include <iomanip>
using namespace std;
int main ()
{
int num;
int i;
cout << "Please enter a positive integer: " << endl;
if (num <=1)
return false;
else if (num == 2)
return true;
else if (num % 2 == 0)
return false;
else (i = 3; i <= num; i++);
return true;
system ("pause");
return 0;
}