Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- bool czy_pierwsza(int n){
- if(n<2)
- return false;
- for(int i=2;i*i<=n;i++)
- if(n%i==0)
- return false;
- return true;
- }
- int main() {
- int testy;
- cin>>testy;
- int i=0;
- while(i<testy)
- {
- int u,l;
- cin>>l>>u;
- for(int n=l;n<=u;n++)
- {
- if(czy_pierwsza(n))
- cout<<n<<endl;
- }
- i++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment