What is the problem in the code it has compiled successfully but is not printing any output

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
int[] a = new int[N];
int i = 0;
while(i<N){
a[i]=sc.nextInt();
i++;
}
int target=sc.nextInt();
for(int m=0; m < N; m++){
for(int j=1; j < (N-i); j++){
if(a[j-1] > a[j]){
//swap elements
int temp = a[j-1];
a[j-1] = a[j];
a[j] = temp;

	}}}
	for(int k=0;k<N;k++){
		int l=k+1;
		int r=N-(k+1);
		while(l<r){
			if((a[k]+a[l]+a[r])==target){
				System.out.println(a[k]+","+" "+a[l]+" "+"and"+" "+a[r]);
			}
			l++;
			r--;
		}
	}

}

}