Sum of odd and even placed digits

#include
#include
int main()
{
int num,nod,i,evensum=0,oddsum=0;
std::cin>>num;

nod = (int)log10(num);

for(i=0;i<=nod;i++)
{
    if(i%2==0)
    {
        evensum = evensum + num/pow(10,nod-i);
    }
    else
    {
        oddsum = oddsum + num/pow(10,nod-i);
    }
    num = num % (int)pow(10,nod-i);
}

std::cout<<oddsum<<std::endl;
std::cout<<evensum;


return 0;

}

what is wrong in this code?? It does not clear two test cases

Hy rahul,
You have quite some issues with your logic. Whenever you are updating the value of num outside the if else conditionals you are using modulo operator which is wrong also inside the conditionals the use of division is wrong. Please go through your logic once again and try to give the link of your code saved on the online ide