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

Which shows 5.45 written as a mixed number?
An unbalanced force of 25 N, E, is applied to a 12-kg mass. What is the acceleration given to the mass?
literary images are enhanced by the use of _______ language.
The Earth has a radius of 6,400 kilometers. A satellite orbits the Earth at a distance of 12,800 kilometers from the center of the Earth. If the weight of the s
Which decimal is equivalent to 13/20?
reduce 15 1/4 +1 1/2 +3/20 to lowest term.
literary images are enhanced by the use of _______ language.
How many months is 0.75 of a year
how long is 63 months in years?
Can you explain 3x+4/5=7/10. Solve