it is very strange i was trying my old code (accepted one and now it is giving wrong answer)
It is very strange i was trying my old code (accepted one and now it is giving wrong answer)
Your approach is not correct here.
You have to find the sum of all digits which are even and the sum of all digits which are odd separately. If the sum of all digits which are even is divisible by 4 or sum of all digits which are odd is divisible by 3, then only print “Yes”. In all other cases print “No”.
Maintain a variable oddsum which will store the sum of all odd digits
and a variable evensum which will store the sum of all even digits
So if digit is odd, you add it to odd sum. And if digit is even, you add it to even sum.
Try to correct your code now.
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.