Array target sum pairs

I am unable to understand how to iterate the loop https://ide.codingblocks.com/s/105025

hey @Aditiverma, you need ton check every pair in the array, if that pair making the target you have to print output.

Now how to create pair,so logic is here
for (int i = 0; i < n; i++)
{
for (int j = i + 1; j < n; j++)
{
if (arr[i] + arr[j] == sum)
{ cout<<arr[i]<<" and "<<arr[j]<<endl;}
}
}

Dry run the above logic for testcase given in question, you will easily understand how loop is runnnig.