I am facing problem in solving this question. My output is correct but when i submitting my code it displays wrong answer
About the challenge
ur code is correct.
u need to print Yes and No in place of yes and no ( Y and N are in uppercase)
ur updated code->
#include<iostream>
using namespace std;
int main() {
int n;
int car_no;
int r;
int ans;
int sum1=0,sum2=0;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>car_no;
int sum1=0,sum2=0;
if(car_no==0)
{
cout<<"Yes"<<endl;
continue;
}
while(car_no>0)
{
r=car_no%10;
(r%2==0) ? sum1+=r: sum2+=r;
car_no=car_no/10;
}
if(sum1%4==0 || sum2%3==0)
{
cout<<"Yes"<<endl;
}
else
{
cout<<"No"<<endl;
}
}
return 0;
}
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.