Problem target sum triplet

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner cin = new Scanner(System.in);
int n = cin.nextInt(), arr[] = new int[n];
for(int i = 0;i<arr.length;i++){
arr[i] = cin.nextInt();
}
int t = cin.nextInt();
for(int i = 0;i<arr.length-2;i++){
for(int j = i+1;j<arr.length-1;j++){
for(int k = j+1;k<arr.length;k++){
if(arr[i]+arr[j]+arr[k] == t){
System.out.println(i + ", “+j+” and "+k);
}
}
}
}
}
}=== what’s the error in the code

@AbhishekAhlawat1102
you are printing the location of your nodes.print the value …
System.out.println(arr[i] + ", " + arr[j] + " and "+ arr[k]);

also sort your array after taking input

Please mark your doubt as resolved, if you are satisfied and you can give ratings too based on my response :slight_smile: