Question: Given: m 1 and two positive numbers each containing m digits, a m - 1 a m - 2 d o t s a 0

Given: m1 and two positive numbers each containing m digits, am-1am-2dotsa0
and bm-1bm-2dotsb0
Wanted: cmcm-1cm-2dotsc0, where
bm-2dotsb0
Algorithm:
Step 1 Set the value of carry to 0
Step 2 Set the value of i to 0
Step 3 While the value of i is less than or equal to m-1, repeat the instruc-
tions in Steps 4 through 6
Step 4 Add the two digits ai and bi to the current value of carry to get ci
Step 5 If ci10, then reset ci to (ci-10) and reset the value of carry to 1 ;
otherwise, set the new value of carry to 0
Step 6 Add 1 to i, effectively moving one column to the left
Step 7 Set cm to the value of carry
Step 8 Print out the final answer, cmcm-1cm-2dotsc0
Step 9 Stop
 Given: m1 and two positive numbers each containing m digits, am-1am-2dotsa0

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!