0

I am trying to write a program that given two integers in two strings, substracts the second integer from the first integer and outputs it.

1. I read in two strings.

2. I reverse them (I am also adding them, I found it easier to add if they are reversed)

3. I check if any of them are negative...

4. If both are negative or no negatives, I add them up.

5. If any ONE of them is negative, I substract the second string from the first string. <<<< Problem >>>>

6. Store the answer in an integer array.

7. Output the integer array BACKWARDS.

Here is what I have so far for substraction, but it doesn't work for some numbers. It gives weird answers like (-1) + 10000 = 90001.

```
for (c = 0; c < len; c++)
{
// If the first number is bigger, then its simple.
if(( one[c] > two[c]) || (two[c] == one[c]))
{
sum[c] = absolute((one[c] - 48) - (two[c] - 48));
}
else if (two[c] > one[c])
{
// If not then find it actual value, add ten to it and then substract it.. :)
sum[c] = absolute(((one[c] + 10) - 48) - (two[c] - 48));
// Then take one away from the next number in 'one'
one[c+1] -= 1;
}
}
```

Can someone help me here? I don't get what I am doing wrong...