返回列表 發帖
  1. #include<iostream>
  2. #include<cstdlib>
  3. using namespace std;
  4. int main()
  5. {
  6.      for(int x=2;x<=1000;x++)
  7.      {
  8.      int i=2;        
  9.           while(x>=i)
  10.           {
  11.                 if(x==i)
  12.                 {         
  13.                 cout<<x<<endl;            
  14.                 }               
  15.                 else if((x%i)==0)
  16.                 {
  17.                 break;
  18.                 }                    
  19.           }
  20.           i++;
  21.           }
  22.                
  23.      system("pause");
  24.      return 0;
  25. }
複製代碼

TOP

返回列表