Delhi's Odd Even Problem

Can you please tell me why it is showing wrong test case for my code?
include
using namespace std;
int main(){
int N,carnum,rem;
cin>>N;
if(N<=1000)
{
for(int i=0;i<N;i++)
{ int sum=0;
cin>>carnum;
if((carnum>=0)&&(carnum<=1000000000))
{
while(carnum!=0)
{
rem=carnum%10;
sum=sum+rem;

                carnum=carnum/10;
            }
            if((sum % 4 == 0)||(sum % 3 == 0))
                    cout<<"Yes"<<endl;
            else
                    cout<<"No"<<endl;
            
        }
    }
}
return 0;

}

Hi @avijuneja2007
In this question what you are doing is that calculating sum of all digits and then checking if it is divisible by 3 or 4 or not. But this is not what ques is asking you to do. In this question you have to calculate sum of even digits and odd digits separately and then check if sum of even digits is divisible by 4 or sum of odd digits is divisible by 3 or not. Then accordingly you have to print yes or no.

1 Like