Guest User

Untitled

a guest
Dec 11th, 2014
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. bool czy_pierwsza(int n){
  5. if(n<2)
  6. return false;
  7. for(int i=2;i*i<=n;i++)
  8. if(n%i==0)
  9. return false;
  10. return true;
  11. }
  12.  
  13. int main() {
  14. int testy;
  15. cin>>testy;
  16. int i=0;
  17. while(i<testy)
  18. {
  19. int u,l;
  20. cin>>l>>u;
  21. for(int n=l;n<=u;n++)
  22. {
  23. if(czy_pierwsza(n))
  24. cout<<n<<endl;
  25.  
  26. }
  27. i++;
  28. }
  29. return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment