Menu

[solved]-Write Program Function Implements Addition Algorithm Refer Week1 Pdf Discussed Lecture Acc Q39004569

Please help me to do these two question in C++, neeeeeeedhelp!

1.

Write a program with a function that implements the Addition Algorithm (refer to week1 PDF) we discussed during lecture and a

Carry = 0 ; Step 1 i = 0 ; Step 2 While (i<=m-1) ; Step 3 Ci=Ai+Bi+Carry Step 4 if Ci >= 10 Step 5 Ci=Ci-10 Carry = 1 else CaFIGURE 1.2 Given: m 2 1 and two positive numbers each containing m digits, am-1 am-2...a, and bm-10m-2...60 Wanted:Cm Cm-1 Cm

2.

Write a program with a function that implements a Multiplication Algorithm based on

Given: m 2 1 and two positive numbers each containing m digits, an- og..., and bm-10m-2...60 Wanted: Cm Cm-CM-2... Cor where

FIGURE 2.10 Get values for a and b If either a = 0 or b= 0) then Set the value of product to O Else Set the value of count to

Write a program with a function that implements the Addition Algorithm (refer to week1 PDF) we discussed during lecture and accept two positive integer string value and perform addition operation and outputs the result. (You might need to initialize Cm string with “O..O” depend on the size of m; alternatively, you can store the Cm in Char array with fix size which we will talk about it later) Carry = 0 ; Step 1 i = 0 ; Step 2 While (i<=m-1) ; Step 3 Ci=Ai+Bi+Carry Step 4 if Ci >= 10 Step 5 Ci=Ci-10 Carry = 1 else Carry = 0 i = i +1 Steplo Cm = Carry Step 7 Print Cm,…,CO Step 8 END FIGURE 1.2 Given: m 2 1 and two positive numbers each containing m digits, am-1 am-2…a, and bm-10m-2…60 Wanted:Cm Cm-1 Cm-2…Co, where cmcm-1 Cm-2… Co = (2-1 0m-2…@o) + (6m-16m-2…60) 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 instructions in Steps 4 through 6 Step 4 Add the two digits a, and b, to the current value of carry to get c; Step 5 If c, z 10, then reset c to (c; – 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 co to the value of carry Step 8 Print out the final answer, Cm Cm-1 Cm-2..Co Step 9 Stop Write a program with a function that implements a Multiplication Algorithm based on Given: m 2 1 and two positive numbers each containing m digits, an- og…, and bm-10m-2…60 Wanted: Cm Cm-CM-2… Cor where ccm-1 Co-go. Co = (2-1 2-2…2.) (6m-bm-2…60) FIGURE 2.10 Get values for a and b If either a = 0 or b= 0) then Set the value of product to O Else Set the value of count to O Set the value of product to O While (count < b) do Set the value of product to (product + a) Set the value of count to (count + 1) End of loop Print the value of product Stop Algorithm for multiplication of nonnegative values via repeated addition Show transcribed image text Write a program with a function that implements the Addition Algorithm (refer to week1 PDF) we discussed during lecture and accept two positive integer string value and perform addition operation and outputs the result. (You might need to initialize Cm string with “O..O” depend on the size of m; alternatively, you can store the Cm in Char array with fix size which we will talk about it later)
Carry = 0 ; Step 1 i = 0 ; Step 2 While (i= 10 Step 5 Ci=Ci-10 Carry = 1 else Carry = 0 i = i +1 Steplo Cm = Carry Step 7 Print Cm,…,CO Step 8 END
FIGURE 1.2 Given: m 2 1 and two positive numbers each containing m digits, am-1 am-2…a, and bm-10m-2…60 Wanted:Cm Cm-1 Cm-2…Co, where cmcm-1 Cm-2… Co = (2-1 0m-2…@o) + (6m-16m-2…60) 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 instructions in Steps 4 through 6 Step 4 Add the two digits a, and b, to the current value of carry to get c; Step 5 If c, z 10, then reset c to (c; – 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 co to the value of carry Step 8 Print out the final answer, Cm Cm-1 Cm-2..Co Step 9 Stop
Write a program with a function that implements a Multiplication Algorithm based on
Given: m 2 1 and two positive numbers each containing m digits, an- og…, and bm-10m-2…60 Wanted: Cm Cm-CM-2… Cor where ccm-1 Co-go. Co = (2-1 2-2…2.) (6m-bm-2…60)
FIGURE 2.10 Get values for a and b If either a = 0 or b= 0) then Set the value of product to O Else Set the value of count to O Set the value of product to O While (count

Expert Answer


Answer to Write a program with a function that implements the Addition Algorithm (refer to week1 PDF) we discussed during lecture … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *