when giving the custom input,output is exactly the same which is needed but when i’m trying to submit the code, two test cases are passed an two are wrong.Where is the problem in code below:
#include
using namespace std;
int main() {
int n;
cin>>n;
int a[1000];
for(int i=0;i<=n;i++){
cin>>a[i];
cout<<endl;
}
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
if((a[i]+a[j])==a[n]){
cout<<a[i]<<" and "<<a[j]<<endl;
}
}
}
return 0;
}
