Why my loop not working for T. please see and correct my code

import java.util.Scanner;

public class MULTIPLES {

public static void main(String[] args) {
    Scanner input=new Scanner(System.in);
    int T=input.nextInt();
    while(T>0){
            
    int N=input.nextInt();
    int i=5,j=3;
    int sum=0;
    while(i<=N) {
        while(j<=i) {

            if(i==j){
                j=j+3;
                break;
            }
            else if(i!=j) {
                if(j==N) {
                    break;
                }
                    System.out.println(j+" ");
                    sum=sum+j;
                    System.out.println("sum +"+sum);            
                     j=j+3;
        }
        }
        if(i!=N){
            System.out.println(i);
        sum=sum+i;
        System.out.println("sum +" +sum);
        
        i=i+5;
        }
    }
    
    T--;
 }
}

}

@KUNAL.SHARMA5724510,
Can you share the appropriate problem statement as well?

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.