I am not able to get all the triplet pairs

Your Mistakes
1)
low and high should be reinitialize inside for loop
low=i+1;
high=n-1;

  1. for binary search you have to use if else conditions not if if conditions

see the code for more details
Modified code

thanks for solving my doubts

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.