fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6. //since 1 is not a prime number
  7. int x=2, y=1;
  8.  
  9. while(x <= 1000000)
  10. {
  11. while(y <=1000000)
  12. {
  13. if(x%y == 0)
  14. {
  15. cout << x << endl;
  16. ++y;
  17. }
  18. else
  19. ++y;
  20. }
  21. x++;
  22. }
  23.  
  24. return 0;
  25. }
Success #stdin #stdout 0.01s 3296KB
stdin
Standard input is empty
stdout
2
2