Arrays-Target Sum Pairs
problem
my code is :
#include
using namespace std;
int main() {int n,i,j;
cin>>n;
int arr[n];
int g=n;
while(g!=0)
{
cin>>arr[g-1];
gā;
}
int target;
cin>>target;
for(i=0;i<n;i++)
{
for(j=i+1;j<n;j++)
{
if ((arr[i]+arr[j])==target)
{ if(arr[i]>arr[j])
{
cout<<arr[j]<<" and "<<arr[i]<<endl;
}
else
{
cout<<arr[i]<<" and "<<arr[j]<<endl;
}
}
}
}
return 0;
}