Delhi's Odd Even

What is wrong in this code.
#include
using namespace std;

int main()
{

int n,no,evensum=0,oddsum=0,d;
cin>>n;

for(int i=1;i<=n;i++)
{
cin>>no;

while(no!=0)
{
d=no%10;

if(d%2==0)
evensum+=d;
else
oddsum+=d;

no/=10;
}

if(evensum%4==0 || oddsum%3==0)
cout<<“Yes”<<endl;

else
cout<<“No”<<endl;

}
return 0;
}

@mvganeshk15 can you please share your code using ide.codingblocks.com so that I can have a better look at it.

Declare int evensum=0,oddsum=0; inside the for loop because we need their value as 0 for every test case. If we declare them only once outside the loop then for other test cases evensum and oddsum will carry the values from the previous test case.

1 Like

Thanks for you help . I understood the problem.

1 Like

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.