Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int n , x,d,y;
- bool ok;
- cin>>n;
- x=3;
- while(n!=0)
- {
- ///x este prim
- ok=1;///am presusp ca x este prim
- for(d=3;d*d<=x && ok==1;d+=2)
- if(x%d==0) ok=0;
- if(ok==1)
- {
- y=x+2;
- ///y este prim
- ok=1;
- for(d=3;d*d<=y && ok==1;d+=2)
- if(y%d==0) ok=0;
- if(ok==1) {cout<<x<<' '<<y<<'\n'; n--;}
- }
- x+=2; ///trec la urmataoarea pereche de test
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement