Sir regarding Delhi odd even problem

Sir, I have run the same code in my vscode and it haven’t showed any error can you please once look into my code

#include
using namespace std;

int main(){
int n;
cin>>n;

int no;

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

    while(no != 0){
        int ld = no % 10;
        sum = sum + ld;
        no = no/10;
    }
    if((sum % 2 == 0 and sum % 4 == 0) or (sum % 2 != 0 and sum % 3 == 0)){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }

}
return 0;

}

you didn’t understand question correctly

plz read the question once again

you have to check that
sum of even digits should be divisible by 4 OR
sum of odd digits should be divisible by 3

so add even digits and odd digits of carNumber seperately
and then check condition

1 Like

Ya ok sir got the answer thank you!

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.