As another example, the Big Adder of Figure 8.50 shows how two Integers of any length can be added digit by digit.1. The two numbers are input with most significant digits first, and put into stacks S1 and S2 with the least significant digits on top. The two numbers are 1 and 5 in the given example.2. The Adder begins with a Carry of 0 on a one-digit-Stack S3.3. The digit in S3 is added to the sum of the top values of Stacks S1 and S2.4. The sum digit is placed onto another stack S4, with the new carry replacing the previous carry digit in S3.5. The output stack S4 is finally output, with the most significant digits leading.The algorithm for Big Adder is shown in Pseudocode 8.32.
đang được dịch, vui lòng đợi..
