I am unable to pass the test case what is the problem with the code

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();

	int i =1;
	while(i<=N){
		int a = sc.nextInt();
		int rem = 0;
		int sum = 0;
		while(a!=0){
			 rem = a%10;
			 sum = sum + rem;
			a=a/10;
		}
		if ((sum%2==0 && sum%4==0)||(sum%2==1 && sum%3==0)){
			System.out.println("Yes");
		}
		else{
			System.out.println("No");
		}
		i++;










	}

}

}

@mishikasrvastava,
Suggested approach:

  • Take input of the Number.
  • Declare two variables to store the sum of even numbers and odd numbers.
  • Extract digit one by one ( by % 10).
    1. Check if the number is even or odd.

    2. If even add the number in the variable storing even sum.

  1. Othewise add it in the variable storing odd sum.
  • After the loop, Check if the even sum is divisible by 4.
    1. If True, print Yes.

    2. otherwise print No.

  • Check if the odd sum is divisible by 3.
    1. If True, print Yes.

    2. otherwise print No.

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.