Take as input N, the size of array. Take N more inputs and store that in an array. Take as input “target”, a number. Write a function which prints all pairs of numbers which sum to target.
#include
using namespace std;
int main() {
int n,t;
int a[n];
for (int i=0;i<n;i++)
{
cin>>a[i];
}
cin>>t;
for (int j=0;j<n;j++)
{
for ( int p=j+1;p<n;p++)
{if (a[j]+a[p]==t)
cout<<a[j]<<" and "<<a[p]<<endl;
}
}
}