frozengirl309 frozengirl309
  • 03-07-2019
  • Computers and Technology
contestada

Give a recursive (or non-recursive) algorithm to compute the product of two positive integers, m and n, using only addition and subtraction ?

Respuesta :

SerenaBochenek SerenaBochenek
  • 14-07-2019

Answer:

Multiply(m,n)

1. Initialize product=0.

2. for i=1 to n

3.      product = product +m.

4. Output product.

Explanation:

Here we take the variable "product" to store the result m×n. And in this algorithm we find m×n by adding m, n times.

Answer Link

Otras preguntas

Provide an appropriate response. Find the z-score that corresponds to the given area under the standard normal curve. please explain how you got your answer
Factor this please and thank you. 18-9w
solve .1-cot⁴o / sin⁴o = 1+2 cot²o​
c^2 - 6c + 8 divided by c^2 + c - 6
40-60 write the lower class limit the upper class limit and the class mark of the following class intervals​
Hi, How are you and your baby? I have something to ask regarding my studies. You know I'm using your old desktop at home to work on my university assignments, b
You borrow 600$ to buy a violin.simple annual interest rate is 15$ you pay off the loan after 2 years of equal monthly payment. How much is each payment
who is at first went in universe?
You are caring for your patient who is unable to bear weight on either leg and has minimal upper body strength. What method would be MOST appropriate for transf
(m-5)÷2=3m+5 solve and check the answer​