Why it is showing TLE?
you need to divide carno by 10 in each iteration. Then your code will work.
Hope it Helps.
Sir, Now I have done that but even now it is showing TLE. What to do now?
No it was working fine. Send the link of your edited code here.
You need to divide carno by 10 in each iteration of the while loop and not in the test case loop.
while(carno>0)
{
int ld=carno%10;
if(ld%2==0)
{
esum=esum+ld;
}
else
{
osum=osum+ld;
}
carno/=10;
}
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.
