Delhi Even Odd problem

import java.util.*;
public class Main {
public static void main(String args[]) {
int n,sum=0;

   ArrayList<Integer> inputs=new ArrayList();
   Scanner sc=new Scanner(System.in);
   n=0;
   if(sc.hasNextInt()){
       
   n = sc.nextInt();
   }
   
    int i = 0;
	  if(n>=1) {
	   while(i++ < n)
	{
		sc.nextLine();
		inputs.add(sc.nextInt());
	}   
   }
   else {
	   System.out.print("Wrong Input");
   }
	
	
	for(Integer val:inputs ) {
		 while(val>0 && val<=1000000000) {
	    	   sum = sum + val % 10; 
	           val = val/10; 
	       }
	     
	       if(sum%2==0 && sum%4==0 ) {
	    	   System.out.println("Yes");
	    	   
	       }
	       else if(sum%2!=0 && sum%3==0) {
	    	   System.out.println("Yes");
	       }
	       else {
	    	   System.out.println("No");
	       }
	}
}

}

this code is working fine but show wrong answer.Please check

Hi @ajay950160,In this question you have to simply get an input of n which denotes how many numbers you have to enter and then enter that many numbers then you have to calculate two sum let it be sum1 and sum2 in which sum1 is the sum of even numbers in the input car’s number and sum2 is equal to the sum of odd numbers in the input car’s number and if sum1%4==0 or sum2%3==0 then print yes else print no. you dont have to print statements like wrong input etc. carefully check the input and output formats given in the question.