Question: Trace through the decimal addition algorithm of Figure 1.2 using the following input values: m = 3 a 2 = 1 a 1? = 4

Trace through the decimal addition algorithm of Figure 1.2 using the following input values:

m = 3 a 2 = 1 a 1? = 4 a 0? = 9

b 2 = 0 b 1 = 2 b 0? = 9

At each step, show the values for c 3 , c 2 , c 1 , c 0 , and carry.

FIGURE 1.2 Given: m 2 1 and two positive numbers each containing

FIGURE 1.2 Given: m 2 1 and two positive numbers each containing m digits, a a m-1m-S Wanted: CC-1 C... Co where Cm Cm-1 Cm-_ .Co = (m_1 m_ga) + (b__b_b) Algorithm: Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Step 7 Step 8 Step 9 Set the value of carry to 0 Set the value of i to 0 a and While the value of i is less than or equal to m - 1, repeat the instructions in Steps 4 through 6 Add the two digits a, and b, to the current value of carry to get c If c, 10, then reset c, to (c, - 10) and reset the value of carry to 1; otherwise, set the new value of carry to 0 Add 1 to i, effectively moving one column to the left Set c_ to the value of carry Print out the final answer, CC-1 C-Co m Stop Algorithm for adding two m-digit numbers

Step by Step Solution

3.45 Rating (155 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To trace through the decimal addition algorithm with the given input val... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Algorithms Questions!