2 testcases are failed whats the problem

#include
#include
using namespace std;
int Target(int a[],int n,int b)
{
for(int i=0;i<n;i++)
{for(int j=i+1;j<n;j++)
{
for(int k=j+1;k<n;k++)
{
if(a[i]+a[j]+a[k]==b)
{
cout<<a[i]<<", “<<a[j]<<” and "<<a[k];
cout<<endl;
}
}
}
}
}
int main()
{
int n,i,a[1000],j,b;
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
cin>>b;
sort(a,a+n);
Target(a,n,b);
return 0;
}

@garganshul151 hey anshul your program have looping mistake

so plz tell my mistake

plz answer completely in one go

@garganshul151 hey anshul do
for(i=0;i<n-2;i++)
{
for(j=i+1;j<n-1;j++)
{
for(k=j+1;k<n;k++)