Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PLEASE, explain well the solution because I really can\'t seem to understand the

ID: 3881169 • Letter: P

Question

PLEASE, explain well the solution because I really can't seem to understand the question or even the addition algorithm and how it works.

Thank you!

FIGURE 1.2 Given: m 2 1 and two positive numbers each c m digits, aa and Algorithm: Step 1 Set the value of carry to 0 Step 2Set the value of i to 0 Step 3 While the value of i is less than or equal to m 1, repeat the instructions in Steps 4 through 6 Step 4 Step 5 Add the two digits a, and b,to the current value of carry to get c If c 10, then reset c to ( 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 Step 6 Step 7 Set c to the value of carry Step 8 Print out the final answer, cmG,-|G,4",do Step9 Stop Algorithm for adding two m-digit numbers

Explanation / Answer

Question:- You are going to add two decimal number and both decimal numbers have different digits or may not have different digits.

For example you have to add 345354+89786 where m is the no. of digit in first decimal number (m=6) and n is the no. of digit in second decimal number(n=5), So m!=n.

Now Come to algorithmto add these numbers.....

Step1: step 1 is saying set the value of carry to zero which is used in the addition ..(carry = 0)

Step2: step 2 is saying set the value of i to zero which is used to iterate the loop for add the two numbers .

Step 3: step3 is saying while (i<=m-1) , Repeat the instruction step4 to 6 , it means we have value of m=6 then we are going to repeat the step 4 to 6 , 6 times till the value of i is reached to 5

(i=0 to 5 , 6 times...)

Step4: Add two digit of first decimal number (Ai) and second decimal number (Bi) to get the value of (Ci) where i = 0 means the first digit of both numbers where Ai = 4 and Bi = 6.

Step5: if the value of Ci is greater than 10 (Ci>10) Then reset the value of Ci to (Ci-10) and set the set the carry to 1 other wise set the new value of carry to 0... Here in our example the Ci value is not greater than 10 so we have the carry value is 1 and Ci value is 0.

Step6: Its saying that add 1 to i for the incerement in the value of i or You can say we need to add the second digit of our numbers so i=1 and Ai = 5 and Bi = 8 , So here we have the carry = 1 and Ci = 1 because Ai+Bi+Carry = 14 and Ci = 14-10 =>4 . So we will increment the value of the i till the i is not equal to 5;

Step7 . Then set Cm to the value of carry if carry is one then set Cm to 1 else Cm to 0. In Our Example we have carry 1 so Cm = 1 if m=n and set Cm to last digit+carry;

Step8. So print out the value of Cm to C0 Where Cm is the carry and C0 to Cm-1 is the added value of A0+B0 to Am-1 + Bm-1. In our Example we have all the values like 435140 ....

C0 To Cm ... RIGHT TO LEFT.....

Step9: Exit...

Thanks a lot, Please let me know if you hava any doubt...............

  

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote