Prime Numbers

#include <iostream>


int main(){

int i,j;

for (i=2; i<1000; i++){
for(j=2;j <=(i/j); j++)


// if  i mode j is ture, break 
if (!(i%j)) break;


if(j> (i/j))

//  write out prime
std:: cout<<i<<std::endl;
}
}

猜你喜欢

转载自www.cnblogs.com/poission/p/10847991.html