#include
using namespace std;
void target_sum_pairs(int n, int a[], int target)
{
int i, j, sum;
for(i = 0; i < n; i++)
{
for(j = i + 1; j < n; j++)
{
sum = a[i] + a[j];
if(sum == target)
{
cout<<a[i] <<" and "<<a[j]<<endl;
}
}
}
}
int main() {
int n, a[1000], target, i;
cin >> n;
for(i = 0; i < n; i ++)
{
cin >> a[i];
}
cin >> target;
target_sum_pairs(n, a, target);
return 0;
}
why does it not work for all test acses???