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

what is the value of x in the equation 4x+8y=40 when y=0.8
Angela earns $6.25 per hour babysitting. Estimate how much she will earn if she babysits for 9 hours this weekend. Explain.
On D-Day, the Allies invaded what German stronghold? a. Southern Italy b. Northern France c. Northern Africa d. Southern Russia
Which statement best illustrates Siddhartha Gautama’s view toward wealth?
Sperm are released out of the male reproductive system through the (2 points)
what is 402 rounded to the nearest ten and hundred
what is 4/20 simplified
The Aryan migration began its spread into India through the Indus River Valley mainly because
what is 800 10 times as much as-------
whats the prefix in the word unafraid