fork download
  1. /*
  2. * Author: Justin Ryan L. Ayubo
  3. * Solution for: PA #1
  4. * Algorithm:
  5. * Details of algo goes here
  6. * Date of Submission: August 21, 2014
  7. * Honor Code:
  8. * I certify that I did not give or receive any aid in this activity and
  9. * that I fully understand the consequences of violating such as
  10. * stipulated in the University Student Handbook
  11. */
  12.  
  13. #include <iostream>
  14.  
  15. using namespace std;
  16.  
  17. int main(){
  18. //since 1 is not a prime number
  19. int x=2, y=1;
  20.  
  21. while(x <= 1000000)
  22. {
  23. while(y <=1000000)
  24. {
  25. if(x%y == 0)
  26. {
  27. cout << x << endl;
  28. y++;
  29. }
  30. else
  31. y++;
  32. }
  33. ++x;
  34. }
  35.  
  36. return 0;
  37. }
Success #stdin #stdout 0.01s 3296KB
stdin
Standard input is empty
stdout
2
2