Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Im trying to solve this but keep getting stuck on step 4- i have never taken a class like this and have been out of
Im trying to solve this but keep getting stuck on step 4- i have never taken a class like this and have been out of school for a few years. I have these options: m=3 a2=1 a1=4 a0=9 b2=0 b1=2 and b0=9
4:06 PM Wed Jan 29 Invitation to Computer Science, 8th Edition Aa 1 QD Chapter 1 An Introduction to Computer Science 9 FIGURE 1.2 Given: m 2 1 and two positive numbers each containing m digits, a-am-2...a and b b 2...b. Wanted: Cm Cm-1 CM-2... Cor where Cm Cm-1 Cm-2... Co = (am-1 am-2...a) + (bm-1 bm-2...b) Algorithm: Step 1 Set the value of carry to O Step 2 Set the value of i to O 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 a and b, to the current value of carry to get Step 5 If c > 10, then reset cto (c. 10) and reset the value of carry to 1; otherwise, set the new value of carry to O Step 6 Add 1 to i, effectively moving one column to the left Step 7 Setc to the value of carry Step 8 Print out the final answer, Cm Cm-1m-2..Co Step 9 Stop Algorithm for adding two m-digit numbers E C OStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started