#4769: 為何一直 逾時??


wille (wille)


#include <iostream>
#include <math.h>
using namespace std;
int main()
{int i,iN=0;
double iX;
while (cin>>iX,iX>=2,iX<=2147483647)
{
 iN=0;
 for (i=2;i<sqrt(iX);i++)
 {
  if ((int) iX%i==0)
  {
   iN=1;
   break;
  }
 }
 if (iN==1)
 {
  cout<<"非質數"<<endl;
 }
 else
 {
  cout<<"質數"<<endl;
 }
}
 return 0;
}

 

 誰能幫看一下??