fork(7) download
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main ()
  7. {
  8. for (int i=2; i<100; i++)
  9. for (int j=2; j*j<=i; j++)
  10. {
  11. if (i % j == 0)
  12. break;
  13. else if (j+1 > sqrt(i)) {
  14. cout << i << " ";
  15.  
  16. }
  17.  
  18. }
  19.  
  20. return 0;
  21. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
5 7 11 13 17 19 23 29 31 37 41 43 47 53 59 61 67 71 73 79 83 89 97