Question: I need to check if the vertical sum of decimal digits in two numbers is the same in every element or not.

For example: Number1 = 153, Number2 = 345. Adding the decimal digits separately:

```
1 + 3 = 4
5 + 4 = 9
3 + 5 = 8

```

So 153 and 345 do not match.

---

But if Number1 = 543 and Number2 = 456:

```
5 + 4 = 9
4 + 5 = 9
3 + 6 = 9

```

The digit sums are all 9, so the function result should be `true`.

Seems like I need to use modulus and a while loop?

Any input would be greatly appreciated!

Answer: 
Using pseudocode, I believe that it could be achieved something like this. Function returns 0 = false, 1 = true. I'm not sure if `mod` is a C function, but since you only asked for "C-like" I think it should suffice.

```
int compare(int a, int b)
{
    int compareTo = -1;
    while(a > 0 && b > 0)
    {
        int temp = (a mod 10) + (b mod 10);
        if (compareTo == -1)
        {
            compareTo = temp;
        }
        else 
        {
            if (compareTo != temp) 
                return 0;
        }
        a /= 10;
        b /= 10;
    }
    return 1;
}

```

Edit based on @Peter's comment:

```
unsigned int compare(unsigned int a, unsigned int b)
{
    unsigned int compareTo = (a % 10) + (b % 10);
    a /= 10;
    b /= 10;  
    while(a > 0 && b > 0)
    {
        unsigned int temp = (a % 10) + (b % 10);

        if (compareTo != temp)
            return 0;

        a /= 10;
        b /= 10;  
    }
    return 1;
}

```
I wrote this in pseudocode because I am more familiar with Java. I also didn't account for if the numbers are different lenghts. Assuming they are the same number of digits, this flow should work:

```
int number1 = 153;
int number2 = 345;
int number1Length = String.valueOf(number1).length();
int number2Length = String.valueOf(number2).length();
int digit1Sum = null;
int digit2Sum = null;
int digit3Sum = null;
for (int i = 0, n = number1Length; i < n; i++){
    String character1Iterator = String.valueOf(number1).getChar(i);
    String character2Iterator = String.valueOf(number2).getChar(i);

   digit{i}Sum = Integer.parseInt(character1Iterator) + Integer.parseInt(character2Iterator);
}

boolean digitsEqual = false;
if(digit1Sum == digit2Sum && digit1Sum == digit3Sum){
    return true;
}

```

You may need to refactor slightly to suit your needs with varying amount of digits, to fit C, etc., but this is basically grabbing the first value of each number and adding it. Then it goes through each digit and adds them until all digit places are summed. Then it check to make sure they are all equal.