Export 1000 within a prime number

#include<iostream>
using namespace std;
int main()
{
 int x=2,k;
 bool t;
 while(x<1000)
 {
  k=2;
  t=true;
  while(k<x)
  {
   if(x%k==0)
   t=false;
   k++;
  }
 if(t)
 cout<<x<<endl;
 x++;
 }
 
}
Published 45 original articles · won praise 36 · views 830

Guess you like

Origin blog.csdn.net/huangziguang/article/details/104408054