Target sum pair question

#include
#include
using namespace std;

int main()
{ int n,t;
int a[10];
cin>>n;
for(int i=0;i<n;i++)
{ cin>>a[i];
cout<<endl;
}
cin>>t;
for(int i=0;i<n-1;i++)
{ for(int j=i+1;j<n;j++)
{ if((t==a[i]+a[j])&&(a[i]<a[j]))
{ cout<<a[i]<<“and”<<a[j]<<endl;
}
if((t==a[i]+a[j])&&(a[i]>a[j]))
{ cout<<a[j]<<“and”<<a[i]<<endl;
}
}
}

return 0;

}

i am unable to understand why my code is wrong and why is it not passing even one test case .please clear my doubt

used many inputs and it shows the right ans after compiling but i still dont know why i am unable to pass any test case

@SARTHAK please try this code https://ide.codingblocks.com/s/213469

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.