wrong answer in test case 4
code:-
#include
using namespace std;
int main()
{
int N, target,sum=0,a[1000];
cin >> N;
for (int i = 0; i < N; i++)
cin >> a[i];
cin >> target;
for (int i = 0; i < N ; i++)
{
for (int j = i; j < N; j++)
{
sum = a[i] + a[j];
if (sum == target)
{
if (a[i] < a[j])
cout << a[i] << " and " << a[j];
else
cout << a[j] << " and " << a[i];
}
sum = 0;
}
cout << endl;
}
return 0;
}
please tell me where to make the correction.