It is simple, we have to use for loop inside a loop;

here its a simple solution for this.

```
#include<bits/c++config.h>
```

int n,i,j,a[n],b;

cin>>n; //its the size of array;

{

for(i=0;i<n;i++)

{cin>>a[n];}

} cin>>b; //element to be searched;

for(i=0;i<n;i++)

{

for(j=i+1;i<n;i++)

{

if(a[i]+a[j]==b)

{cout<<"{"<<a[i]<<","<<a[j]<<"}"<<endl;

}

}

}

return 0;

}

sample input: 5 1 2 3 4 5 7 sample output: {2,5} {3,4}

this is how we could easily execute this problem.