This week our lecturer in microprocessor architecture showed us how the two's complement and the ten's complement can be used to do subtract by doing addition.
For example: 15 - 7
maximalNumberOfTheCurrentRange - numberToSubtract + 1 => 99 - 7 + 1 = 93
Then
15
+93
===
108 as intermediate result.
Now remove the leading 1. => It becomes the final result 8 !
But how does that work?
I mean: I understand how to do the algorithm. But I would to understand the trick which is used here.
Can someone explain it to me in an easy to understand way?
I would very appreciate it.
I'm not much into academic mathematics I should mention ...
Moreover: What's the difference between the so-called "one's complement" and the "two's complement"?