Wrong Test case

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

		}
	}
}
return 0;

}

@vishwash.bajpai87 Note that all triplets must be printed in sorted order. You are not printing it in sorted order.

How to sort the given values of i,j,k

@vishwash.bajpai87 When you get a result, ie. three numbers summing to the target the minimum of the 3 numbers must be printed first, then the next smallest and then the largest. You can do this by just imposing some conditional statements

@vishwash.bajpai87
Since you have opened this doubt after such a long time. Can you please tell me what your doubt is?

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.