Home / Expert Answers / Computer Science / this-algorithm-will-multiple-a-number-by-repeatedly-adding-the-value-of-a-the-number-of-times-stated-pa128

(Solved): This algorithm will multiple a number by repeatedly adding thevalue of A the number of times stated ...



This algorithm will multiple a number by repeatedly adding the value of A the number of times stated in the value of  B. 

For example, if A = 10 and B = 3, This algorithm will perform the following :

10 + 10 + 10 = 30

Tip: Notice that this only added the value of A 3 times but in your response, you will see it shows up to 4 iterations.  
         If this happens in any of these exercises, the proper answer would be "Loop Ended" for both Count and Product.

 

A = 8   B = 2

Get A

Get B

 STEP 1   If A  or B = 0

Then Set Product to = 0 and Go To STEP 3

Else Set Count to 0 and Set Product to 0 and Go To STEP 2

STEP 2   While Count   < B

                                Set Product to (Product + A)

                                Set Count to (Count + 1)

End of Loop;

STEP 3   Print the value of Product

STEP 4 Stop

 


We have an Answer from Expert

View Expert Answer

Expert Answer


I am providing the solution in C, i hpe you will

We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe