#include <stdafx.h>
#include
#include
using namespace std;
int main()
{
int n;
cout<<"please input a positive integer: ";
cin>>n;
while(n<=0)
{
cout<<"Wrong input,positive integer needed: ";
cin>>n;
}
void estimate(int);
estimate(n);
system(“pause”);
return 0;
}
void estimate(int n)
{
int i,a;
for(i=2;i<n;i++)
{
a=n%i;
if(a0)
{
break;
}
}
if(a0)
{
cout<<“it’s not a prime number”<<endl;
}
if(a!=0)
{
cout<<“it’s a prime number”<<endl;
}
}