Why is test case 0 not passing?

#include
using namespace std;

int main() {
//target sum pair

int n,a[1000],target;
cin>>n;
cout<<endl;
if(n>1 and n<1000){
for(int i=0;i<n;i++){
cin>>a[i];
cout<<endl;
}
cin>>target;
int i=0,j=n-1;

for(i=0;i<n;i++){
for(j=n-1;j>=i;j–){
if(a[i]+a[j]==target){
if(a[i]<a[j])
cout<<a[i]<<" and "<<a[j]<<endl;

  else
  cout<<a[j]<<" and "<<a[i]<<endl;
}

}
}
}

return 0;
}

Please save your code on ide.codingblocks.com and then share its link.

it is not producing a shareable link!

You just have to click on the save button and then copy the url