sir i have a doubt i made a program which works fine for many cases but still shows the test case fails why so pls make me correct where i am wrong#include
using namespace std;
int main()
{
unsigned int N;
cin>>N;
while(N>0)
{
int sum_of_even_digits=0;
int sum_of_odd_digits=0;
unsigned int no;
cin>>no;
while(no!=0)
{
int last_digit=no%10;
if(last_digit%2==0)
{
sum_of_even_digits=sum_of_even_digits+last_digit;
}
else
{
sum_of_odd_digits=sum_of_odd_digits+last_digit;
}
no=no/10;
}
if(sum_of_even_digits%4==0 or sum_of_odd_digits%3==0)
{
cout<<“YES”<<endl;
}
else
{
cout<<“NO”<<endl;
}
N=N-1;
}
return 0;
}
Delhi odd even delhi odd even delhi odd even
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.