I don't see why it wouldn't work (at least in theory, there may be some bugs in the implementation):
0199991
0000009
_______
0200000
It should count 5 carries.
To be honest the for-loops...
Type: Posts; User: helloworld922
I don't see why it wouldn't work (at least in theory, there may be some bugs in the implementation):
0199991
0000009
_______
0200000
It should count 5 carries.
To be honest the for-loops...
Just add an extra zero. Adding two numbers can never go more than 1 digit over the longer of the two numbers. You will need a separate carry variable.
049 + 051 = 100
You'd count 2 carries.
...
The simplest way is to take your code and force the two arrays to be the same length (whichever is longer). You can do this by adding zeros to the left ("011" = "11" numerically, should work with...