0

Could there be any better ways to determine whether a number is prime or not particularly with respect to code execution.

```
#include <iostream.h>
#include <conio.h>
void PrimeTest(int);
main()
{
int num;
cout<<"Enter number: ";
cin>>num;
PrimeTest(num);
getch();
}
void PrimeTest(int n)
{
bool isPrime=true;
for(short i=2;i<=(n-1);i++)
{
if (n%i==0)
{
isPrime=false;
break;
}
else
{
isPrime=true;
}
}
if ((isPrime) || (n<=2))
{
cout<<n<<" is a prime number!";
}
else
{
cout<<n<<" is not a prime number!";
}
}
```