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

if a pH of water is 5.3 then 4.3 is it 1.0 less acidic 1.0 less basic
Factor the polynomial 6b^2-17b+10
my teddy bear gave me a hug is an example of 1.metaphor 2.personification 3.simile 4.alliteration
What is 0.75 as a fraction in simplist form
find an equation of the tangent line to the circle x^2 +y^2=24 at the point (-2 square root 5, 2).
why a flat surface of a rectangular prism called faces?
find an equation of the tangent line to the circle x^2 +y^2=24 at the point (-2 square root 5, 2).
What is 574 in expanded form
which organism would more closely resemble it's parent,one produced by asexual reproduction,or one produced by sexual reproduction? why?
in what way is a gene pool representative of a population