(Purpose of the code is write in the title) my code work only if i put the same number once and in the end like - 123455 but if i write 12345566 is dosent work or 11234 it dosent wort to someone know why? i have been trying for a few days and i faild agine and agine.
while(num)
{
    dig = num % 10   // dig is the digit in the number                          
    num /= 10        // num is the number the user enter
    while(num2)      // num2 = num
    {
        num2 /= 10
        dig2 = num2 % 10   // dig2 is is the one digit next to dig  
        num2 /= 10
    
        if(dig2 == dig)    // here I check if I got the same digit twice to 
                           // not include him
        {
            dig2 = 0
            dig = 0
        }
    }
    sum = sum + dig + hold
}
printf("%d", sum)
 
     
     
     
    