Advertisement
alex326

Untitled

Jan 22nd, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.28 KB | None | 0 0
  1. problema 374
  2.  
  3. #include <iostream>
  4. using namespace std;
  5. int main()
  6. {
  7. int n,d=2,ok=0,a=2;
  8. cin>>n;
  9. while (a<=n){
  10. d=2;
  11. ok=0;
  12. while (d<=a/2){
  13. if (a%d==0)
  14. ok=1;
  15. d++;
  16. }
  17. if (ok==0)
  18. cout<<a<<" ";
  19. a++;
  20. }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement