I am getting wrong answer in delhi odd and even problem though i cant find any problem in my code

import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner in=new Scanner(System.in);
long n=in.nextLong();
long p;
int sum=0;
for(p=1;p<=n;p++)
{
sum=0;
int temp=in.nextInt();
while(temp!=0)
{
sum=sum+temp%10;
temp=temp/10;
}
if((sum%2==0&&sum%4==0)||(sum%2!=0&&sum%3==0))
{
System.out.println(“Yes”);
}
else
System.out.println(“No”);

   }

}

}

Hi @sank6363,
You read the question all wrong. The question states that if the sum of all the “digits” which are even is divisible by 4 and the sum of ‘digits’ which are odd is divisible by 3. What you are doing is if sum of all the digits of number is divisible by 4 and 3 respectively. All the digits are not to be taken , the odd and even digits are to be taken saperately.

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.