#include
using namespace std;
void printpair(int a[],int n,int target){
int sum=0,p1,p2;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
if(a[i]+a[j]==target){
cout<<a[i]<<" and "<<a[j];
}
}
cout<<endl;
}
return;
}
int main() {
int arr[1000],n,target;
cin>>n;
for(int i=0;i<n;i++){
cin>>arr[i];
}
cin>>target;
printpair(arr,n,target);
return 0;
}
I am getting wrong answer
hi Gurdeep can u save your code on coding block online ide ans then post the link here it is easy to debug then
U have to print smaller number first than bigger