DELHI ODD EVEN, output is coming correct but the test case is not passed

this is the code
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int arr[]=new int[n];
for(int i=0;i<n;i++)
{
arr[i]=sc.nextInt();
}
for(int i=0;i<n;i++)
{
int a=arr[i];
if(a%2==0)
{
int sum1=0;
while(a>0)
{
int rem=a%10;
sum1=sum1+rem;
a=a/10;
}
if(sum1%4==0)
{
System.out.println(“Yes”);
}
else
{
System.out.println(“No”);
}
}
else
{
int sum2=0;
while(a>0)
{
int rem=a%10;
sum2=sum2+rem;
a=a/10;
}
if(sum2%3==0)
{
System.out.println(“Yes”);
}
else
{
System.out.println(“No”);
}
}
}

Hi @rocky12,
Please read the question correctly. You must add the even digits and check if the sum of even digits is divisible by 4 not if the the whole number is even and then if the sum is divisible by 4. Similar goes for odd digits too .So you must add the even digits of the number seperately and the odd digit of the number seperately and then check whether the sum of even digits is divisible by 4 and sum of odd digit is divisible by 3.
Hope this helps .

Thanks a lot Sir, now all test cases are passed correctly

Please like and mark the doubt as resolved if this issue is resolved … Happy to help :relaxed: