#7063: 請各位大大幫忙檢查一下是否有錯(c++)


peter245 (peter)


#include<iostream>
using namespace std;
int main(void)
{
 int n=0;
 while(cin>>n)
 {
  int p=0;
 
  for(int i=1;i<n/2;i++)
   {
    if(n%i==0 && n!=2)
    {
     p++;
    }
   }
  if(p>1)  
  {
   cout<<"非質數"<<endl;
  }
  if(p==1)  
  {
   cout<<"質數"<<endl;
  }
 
 }
 return 0; 
}