In the question Delhi’s Odd Even, what have I done wrong??
Please let me know.
What is the Error?
hEY @gaurisha
#include<iostream>
using namespace std;
int main() {
int n, cn, sumT=0, sumOdd=0, remain;
cin>>n;
for(int i=1; i<=n; i++)
{
sumT=0, sumOdd=0;///REINITIALIZE SINCE MANY TESTCASES
cin>>cn;
while(cn>0)
{
remain=cn % 10;
sumT += remain;
if(remain % 2 == 1)
{
sumOdd += remain;
}
cn /= 10;
}
sumT-=sumOdd; //AADDED THIS :SINCE EVEN SUM
if(sumT % 4 == 0 or sumOdd % 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.